Selaa lähdekoodia

feat: optimize getHeaders

Dogtiti 1 vuosi sitten
vanhempi
commit
700b06f9c5
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      app/client/api.ts

+ 2 - 2
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<string, string> = {
     "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;