From c6ebd6e73cbc58bbd752eeab22a3b029985d2e57 Mon Sep 17 00:00:00 2001 From: Dogtiti <499960698@qq.com> Date: Fri, 27 Sep 2024 17:00:24 +0800 Subject: [PATCH] fix: default model --- app/store/access.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/store/access.ts b/app/store/access.ts index d74cb9d0249..9fcd227e7c0 100644 --- a/app/store/access.ts +++ b/app/store/access.ts @@ -211,10 +211,13 @@ export const useAccessStore = createPersistStore( }) .then((res) => res.json()) .then((res) => { - // Set default model from env request - let defaultModel = res.defaultModel ?? ""; - if (defaultModel !== "") - DEFAULT_CONFIG.modelConfig.model = defaultModel; + const defaultModel = res.defaultModel ?? ""; + if (defaultModel !== "") { + const [model, providerName] = defaultModel.split("@"); + DEFAULT_CONFIG.modelConfig.model = model; + DEFAULT_CONFIG.modelConfig.providerName = providerName; + } + return res; }) .then((res: DangerConfig) => {