Skip to content

Commit

Permalink
using default azure api-version value
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydzhou committed Jul 5, 2024
1 parent 14bc1b6 commit 6dc4844
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
9 changes: 6 additions & 3 deletions app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(","),
Expand All @@ -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 {
Expand Down

0 comments on commit 6dc4844

Please sign in to comment.