فهرست منبع

using default azure api-version value

lloydzhou 1 سال پیش
والد
کامیت
6dc4844c12
2فایلهای تغییر یافته به همراه9 افزوده شده و 4 حذف شده
  1. 3 1
      app/api/common.ts
  2. 6 3
      app/client/platforms/openai.ts

+ 3 - 1
app/api/common.ts

@@ -58,7 +58,9 @@ export async function requestOpenai(req: NextRequest) {
   );
 
   if (isAzure) {
-    const azureApiVersion = req?.nextUrl?.searchParams?.get("api-version");
+    const azureApiVersion =
+      req?.nextUrl?.searchParams?.get("api-version") ||
+      serverConfig.azureApiVersion;
     baseUrl = baseUrl.split("/deployments").shift() as string;
     path = `${req.nextUrl.pathname.replaceAll(
       "/api/azure/",

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

@@ -146,8 +146,11 @@ export class ChatGPTApi implements LLMApi {
         // find model, and get displayName as deployName
         const { models: configModels, customModels: configCustomModels } =
           useAppConfig.getState();
-        const { defaultModel, customModels: accessCustomModels } =
-          useAccessStore.getState();
+        const {
+          defaultModel,
+          customModels: accessCustomModels,
+          useCustomConfig,
+        } = useAccessStore.getState();
         const models = collectModelsWithDefaultModel(
           configModels,
           [configCustomModels, accessCustomModels].join(","),
@@ -161,7 +164,7 @@ export class ChatGPTApi implements LLMApi {
         chatPath = this.path(
           Azure.ChatPath(
             (model?.displayName ?? model?.name) as string,
-            useAccessStore.getState().azureApiVersion,
+            useCustomConfig ? useAccessStore.getState().azureApiVersion : "",
           ),
         );
       } else {