From 5033d7fe458fba54afc297698588f1512331f97d Mon Sep 17 00:00:00 2001 From: crazywoola <427733928@qq.com> Date: Tue, 9 Apr 2024 20:21:21 +0800 Subject: [PATCH 1/2] feat: remove unregistered-llm-in-debug --- .../wenxin/llm/ernie-3.5-4k-0205.yaml | 2 +- .../model-provider-page/declarations.ts | 16 ++++++++-------- .../account-setting/model-provider-page/hooks.ts | 4 +++- .../model-parameter-modal/index.tsx | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/api/core/model_runtime/model_providers/wenxin/llm/ernie-3.5-4k-0205.yaml b/api/core/model_runtime/model_providers/wenxin/llm/ernie-3.5-4k-0205.yaml index 7fea3872b15e2f..befa8b3c16ad22 100644 --- a/api/core/model_runtime/model_providers/wenxin/llm/ernie-3.5-4k-0205.yaml +++ b/api/core/model_runtime/model_providers/wenxin/llm/ernie-3.5-4k-0205.yaml @@ -1,4 +1,4 @@ -model: ernie-3.5-8k +model: ernie-3.5-4k-0205 label: en_US: Ernie-3.5-8K model_type: llm diff --git a/web/app/components/header/account-setting/model-provider-page/declarations.ts b/web/app/components/header/account-setting/model-provider-page/declarations.ts index da8c69b69d3075..e7d799ff9b4d70 100644 --- a/web/app/components/header/account-setting/model-provider-page/declarations.ts +++ b/web/app/components/header/account-setting/model-provider-page/declarations.ts @@ -1,8 +1,8 @@ export type FormValue = Record export type TypeWithI18N = { - '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: '无使用权限', }, } diff --git a/web/app/components/header/account-setting/model-provider-page/hooks.ts b/web/app/components/header/account-setting/model-provider-page/hooks.ts index 58c7dc906d399f..27f2b15582f8fb 100644 --- a/web/app/components/header/account-setting/model-provider-page/hooks.ts +++ b/web/app/components/header/account-setting/model-provider-page/hooks.ts @@ -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, } } diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx index c9ce37a7e58ddd..b1aba24eae87fd 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx @@ -93,7 +93,7 @@ const ModelParameterModal: FC = ({ const { currentProvider, currentModel, - textGenerationModelList, + activeTextGenerationModelList, } = useTextGenerationCurrentProviderAndModelAndModelList( { provider, model: modelId }, ) @@ -114,7 +114,7 @@ const ModelParameterModal: FC = ({ } 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 = ({ From df581111d3541250ac006a99cd3e08c5f0c18c6f Mon Sep 17 00:00:00 2001 From: crazywoola <427733928@qq.com> Date: Tue, 9 Apr 2024 20:41:19 +0800 Subject: [PATCH 2/2] feat: label --- .../model_providers/wenxin/llm/ernie-3.5-4k-0205.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/core/model_runtime/model_providers/wenxin/llm/ernie-3.5-4k-0205.yaml b/api/core/model_runtime/model_providers/wenxin/llm/ernie-3.5-4k-0205.yaml index befa8b3c16ad22..9487342a1d2c54 100644 --- a/api/core/model_runtime/model_providers/wenxin/llm/ernie-3.5-4k-0205.yaml +++ b/api/core/model_runtime/model_providers/wenxin/llm/ernie-3.5-4k-0205.yaml @@ -1,6 +1,6 @@ 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