| @@ -1,6 +1,6 @@ | |||
| model: ernie-3.5-8k | |||
| model: ernie-3.5-4k-0205 | |||
| label: | |||
| en_US: Ernie-3.5-8K | |||
| en_US: Ernie-3.5-4k-0205 | |||
| model_type: llm | |||
| features: | |||
| - agent-thought | |||
| @@ -1,8 +1,8 @@ | |||
| export type FormValue = Record<string, any> | |||
| export type TypeWithI18N<T = string> = { | |||
| 'en-US': T | |||
| 'zh-Hans': T | |||
| en_US: T | |||
| zh_Hans: T | |||
| [key: string]: T | |||
| } | |||
| @@ -67,16 +67,16 @@ export enum ModelStatusEnum { | |||
| export const MODEL_STATUS_TEXT: { [k: string]: TypeWithI18N } = { | |||
| 'no-configure': { | |||
| 'en-US': 'No Configure', | |||
| 'zh-Hans': '未配置凭据', | |||
| en_US: 'No Configure', | |||
| zh_Hans: '未配置凭据', | |||
| }, | |||
| 'quota-exceeded': { | |||
| 'en-US': 'Quota Exceeded', | |||
| 'zh-Hans': '额度不足', | |||
| en_US: 'Quota Exceeded', | |||
| zh_Hans: '额度不足', | |||
| }, | |||
| 'no-permission': { | |||
| 'en-US': 'No Permission', | |||
| 'zh-Hans': '无使用权限', | |||
| en_US: 'No Permission', | |||
| zh_Hans: '无使用权限', | |||
| }, | |||
| } | |||
| @@ -11,11 +11,11 @@ import type { | |||
| DefaultModel, | |||
| DefaultModelResponse, | |||
| Model, | |||
| ModelTypeEnum, | |||
| } from './declarations' | |||
| import { | |||
| ConfigurateMethodEnum, | |||
| ModelStatusEnum, | |||
| } from './declarations' | |||
| import I18n from '@/context/i18n' | |||
| import { | |||
| @@ -132,6 +132,7 @@ export const useCurrentProviderAndModel = (modelList: Model[], defaultModel?: De | |||
| export const useTextGenerationCurrentProviderAndModelAndModelList = (defaultModel?: DefaultModel) => { | |||
| const { textGenerationModelList } = useProviderContext() | |||
| const activeTextGenerationModelList = textGenerationModelList.filter(model => model.status === ModelStatusEnum.active) | |||
| const { | |||
| currentProvider, | |||
| currentModel, | |||
| @@ -141,6 +142,7 @@ export const useTextGenerationCurrentProviderAndModelAndModelList = (defaultMode | |||
| currentProvider, | |||
| currentModel, | |||
| textGenerationModelList, | |||
| activeTextGenerationModelList, | |||
| } | |||
| } | |||
| @@ -93,7 +93,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({ | |||
| const { | |||
| currentProvider, | |||
| currentModel, | |||
| textGenerationModelList, | |||
| activeTextGenerationModelList, | |||
| } = useTextGenerationCurrentProviderAndModelAndModelList( | |||
| { provider, model: modelId }, | |||
| ) | |||
| @@ -114,7 +114,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({ | |||
| } | |||
| const handleChangeModel = ({ provider, model }: DefaultModel) => { | |||
| const targetProvider = textGenerationModelList.find(modelItem => modelItem.provider === provider) | |||
| const targetProvider = activeTextGenerationModelList.find(modelItem => modelItem.provider === provider) | |||
| const targetModelItem = targetProvider?.models.find(modelItem => modelItem.model === model) | |||
| setModel({ | |||
| modelId: model, | |||
| @@ -223,7 +223,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({ | |||
| </div> | |||
| <ModelSelector | |||
| defaultModel={(provider || modelId) ? { provider, model: modelId } : undefined} | |||
| modelList={textGenerationModelList} | |||
| modelList={activeTextGenerationModelList} | |||
| onSelect={handleChangeModel} | |||
| /> | |||
| </div> | |||