From b920027bb37f9e202874c500f5cf6ca7df64837c Mon Sep 17 00:00:00 2001 From: Hk-Gosuto Date: Tue, 20 Feb 2024 10:25:30 +0800 Subject: [PATCH] fix: #198 --- app/api/langchain/tool/agent/agentapi.ts | 3 ++- app/store/chat.ts | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/api/langchain/tool/agent/agentapi.ts b/app/api/langchain/tool/agent/agentapi.ts index 239341c3c95..d5b03a7ba06 100644 --- a/app/api/langchain/tool/agent/agentapi.ts +++ b/app/api/langchain/tool/agent/agentapi.ts @@ -225,7 +225,8 @@ export class AgentApi { const serverConfig = getServerSideConfig(); // const reqBody: RequestBody = await req.json(); - const isAzure = reqBody.isAzure || serverConfig.isAzure; + // ui set azure model provider + const isAzure = reqBody.isAzure; const authHeaderName = isAzure ? "api-key" : "Authorization"; const authToken = req.headers.get(authHeaderName) ?? ""; const token = authToken.trim().replaceAll("Bearer ", "").trim(); diff --git a/app/store/chat.ts b/app/store/chat.ts index 0e50cc36d0a..599aac42b37 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -91,6 +91,11 @@ function createEmptySession(): ChatSession { } function getSummarizeModel(currentModel: string) { + // if the current model does not exist in the default model + // example azure services cannot use SUMMARIZE_MODEL + const model = DEFAULT_MODELS.find((m) => m.name === currentModel); + console.log("model", model); + if (!model) return currentModel; // if it is using gpt-* models, force to use 3.5 to summarize return currentModel.startsWith("gpt") ? SUMMARIZE_MODEL : currentModel; }