Quellcode durchsuchen

chore: optimize the code

Dogtiti vor 1 Jahr
Ursprung
Commit
14bc1b6aac
3 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen
  1. 1 1
      app/client/api.ts
  2. 3 4
      app/client/platforms/openai.ts
  3. 1 0
      app/constant.ts

+ 1 - 1
app/client/api.ts

@@ -162,7 +162,7 @@ export function getHeaders() {
     Accept: "application/json",
   };
   const modelConfig = useChatStore.getState().currentSession().mask.modelConfig;
-  const isGoogle = modelConfig.providerName == ServiceProvider.Azure;
+  const isGoogle = modelConfig.providerName == ServiceProvider.Google;
   const isAzure = modelConfig.providerName === ServiceProvider.Azure;
   const isAnthropic = modelConfig.providerName === ServiceProvider.Anthropic;
   const authHeader = isAzure

+ 3 - 4
app/client/platforms/openai.ts

@@ -142,13 +142,12 @@ export class ChatGPTApi implements LLMApi {
 
     try {
       let chatPath = "";
-      if (modelConfig.providerName == ServiceProvider.Azure) {
+      if (modelConfig.providerName === ServiceProvider.Azure) {
         // find model, and get displayName as deployName
         const { models: configModels, customModels: configCustomModels } =
           useAppConfig.getState();
         const { defaultModel, customModels: accessCustomModels } =
           useAccessStore.getState();
-
         const models = collectModelsWithDefaultModel(
           configModels,
           [configCustomModels, accessCustomModels].join(","),
@@ -156,8 +155,8 @@ export class ChatGPTApi implements LLMApi {
         );
         const model = models.find(
           (model) =>
-            model.name == modelConfig.model &&
-            model?.provider?.providerName == ServiceProvider.Azure,
+            model.name === modelConfig.model &&
+            model?.provider?.providerName === ServiceProvider.Azure,
         );
         chatPath = this.path(
           Azure.ChatPath(

+ 1 - 0
app/constant.ts

@@ -153,6 +153,7 @@ const openaiModels = [
   "gpt-4o-2024-05-13",
   "gpt-4-vision-preview",
   "gpt-4-turbo-2024-04-09",
+  "gpt-4-1106-preview",
 ];
 
 const googleModels = [