From 700b06f9c5cc396b54aacebe0741e7d23ba56266 Mon Sep 17 00:00:00 2001 From: Dogtiti <499960698@qq.com> Date: Sat, 6 Jul 2024 11:16:00 +0800 Subject: [PATCH] feat: optimize getHeaders --- app/client/api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/client/api.ts b/app/client/api.ts index 8c984105e1e..7256304f705 100644 --- a/app/client/api.ts +++ b/app/client/api.ts @@ -157,6 +157,7 @@ export class ClientApi { export function getHeaders() { const accessStore = useAccessStore.getState(); + const chatStore = useChatStore.getState(); const headers: Record = { "Content-Type": "application/json", Accept: "application/json", @@ -165,8 +166,7 @@ export function getHeaders() { const clientConfig = getClientConfig(); function getConfig() { - const modelConfig = useChatStore.getState().currentSession() - .mask.modelConfig; + const modelConfig = chatStore.currentSession().mask.modelConfig; const isGoogle = modelConfig.providerName == ServiceProvider.Google; const isAzure = modelConfig.providerName === ServiceProvider.Azure; const isAnthropic = modelConfig.providerName === ServiceProvider.Anthropic;