add support for Tencent Hunyuan (#2015)

### What problem does this PR solve?

#1853 

### Type of change


- [X] New Feature (non-breaking change which adds functionality)

Co-authored-by: Zhedong Cen <cenzhedong2@126.com>
This commit is contained in:
黄腾
2024-08-20 15:27:13 +08:00
committed by GitHub
parent 5efb3476f2
commit 6f438e0a49
15 changed files with 327 additions and 9 deletions

View File

@@ -34,10 +34,12 @@ import {
useHandleDeleteLlm,
useSubmitApiKey,
useSubmitBedrock,
useSubmitHunyuan,
useSubmitOllama,
useSubmitSystemModelSetting,
useSubmitVolcEngine,
} from './hooks';
import HunyuanModal from './hunyuan-modal';
import styles from './index.less';
import OllamaModal from './ollama-modal';
import SystemModelSettingModal from './system-model-setting-modal';
@@ -88,7 +90,9 @@ const ModelCard = ({ item, clickApiKey }: IModelCardProps) => {
<Col span={12} className={styles.factoryOperationWrapper}>
<Space size={'middle'}>
<Button onClick={handleApiKeyClick}>
{isLocalLlmFactory(item.name) || item.name === 'VolcEngine'
{isLocalLlmFactory(item.name) ||
item.name === 'VolcEngine' ||
item.name === 'Tencent Hunyuan'
? t('addTheModel')
: 'API-Key'}
<SettingOutlined />
@@ -162,6 +166,14 @@ const UserSettingModel = () => {
volcAddingLoading,
} = useSubmitVolcEngine();
const {
HunyuanAddingVisible,
hideHunyuanAddingModal,
showHunyuanAddingModal,
onHunyuanAddingOk,
HunyuanAddingLoading,
} = useSubmitHunyuan();
const {
bedrockAddingLoading,
onBedrockAddingOk,
@@ -174,8 +186,9 @@ const UserSettingModel = () => {
() => ({
Bedrock: showBedrockAddingModal,
VolcEngine: showVolcAddingModal,
'Tencent Hunyuan': showHunyuanAddingModal,
}),
[showBedrockAddingModal, showVolcAddingModal],
[showBedrockAddingModal, showVolcAddingModal, showHunyuanAddingModal],
);
const handleAddModel = useCallback(
@@ -286,6 +299,13 @@ const UserSettingModel = () => {
loading={volcAddingLoading}
llmFactory={'VolcEngine'}
></VolcEngineModal>
<HunyuanModal
visible={HunyuanAddingVisible}
hideModal={hideHunyuanAddingModal}
onOk={onHunyuanAddingOk}
loading={HunyuanAddingLoading}
llmFactory={'Tencent Hunyuan'}
></HunyuanModal>
<BedrockModal
visible={bedrockAddingVisible}
hideModal={hideBedrockAddingModal}