add support for XunFei Spark (#2017)

### What problem does this PR solve?

#1853  add support for XunFei Spark

### 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 16:56:42 +08:00
committed by GitHub
parent 02985fc905
commit be431449bd
12 changed files with 190 additions and 6 deletions

View File

@@ -36,12 +36,14 @@ import {
useSubmitBedrock,
useSubmitHunyuan,
useSubmitOllama,
useSubmitSpark,
useSubmitSystemModelSetting,
useSubmitVolcEngine,
} from './hooks';
import HunyuanModal from './hunyuan-modal';
import styles from './index.less';
import OllamaModal from './ollama-modal';
import SparkModal from './spark-modal';
import SystemModelSettingModal from './system-model-setting-modal';
import VolcEngineModal from './volcengine-modal';
@@ -92,7 +94,8 @@ const ModelCard = ({ item, clickApiKey }: IModelCardProps) => {
<Button onClick={handleApiKeyClick}>
{isLocalLlmFactory(item.name) ||
item.name === 'VolcEngine' ||
item.name === 'Tencent Hunyuan'
item.name === 'Tencent Hunyuan' ||
item.name === 'XunFei Spark'
? t('addTheModel')
: 'API-Key'}
<SettingOutlined />
@@ -174,6 +177,14 @@ const UserSettingModel = () => {
HunyuanAddingLoading,
} = useSubmitHunyuan();
const {
SparkAddingVisible,
hideSparkAddingModal,
showSparkAddingModal,
onSparkAddingOk,
SparkAddingLoading,
} = useSubmitSpark();
const {
bedrockAddingLoading,
onBedrockAddingOk,
@@ -187,8 +198,14 @@ const UserSettingModel = () => {
Bedrock: showBedrockAddingModal,
VolcEngine: showVolcAddingModal,
'Tencent Hunyuan': showHunyuanAddingModal,
'XunFei Spark': showSparkAddingModal,
}),
[showBedrockAddingModal, showVolcAddingModal, showHunyuanAddingModal],
[
showBedrockAddingModal,
showVolcAddingModal,
showHunyuanAddingModal,
showSparkAddingModal,
],
);
const handleAddModel = useCallback(
@@ -306,6 +323,13 @@ const UserSettingModel = () => {
loading={HunyuanAddingLoading}
llmFactory={'Tencent Hunyuan'}
></HunyuanModal>
<SparkModal
visible={SparkAddingVisible}
hideModal={hideSparkAddingModal}
onOk={onSparkAddingOk}
loading={SparkAddingLoading}
llmFactory={'XunFei Spark'}
></SparkModal>
<BedrockModal
visible={bedrockAddingVisible}
hideModal={hideBedrockAddingModal}