Skip to content

Commit

Permalink
feat: close ChatGPTNextWeb#2175 use default api host if endpoint is e…
Browse files Browse the repository at this point in the history
…mpty
  • Loading branch information
Yidadaa committed Jun 28, 2023
1 parent 0f5f3c9 commit 70ea71c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { OpenaiPath, REQUEST_TIMEOUT_MS } from "@/app/constant";
import {
DEFAULT_API_HOST,
OpenaiPath,
REQUEST_TIMEOUT_MS,
} from "@/app/constant";
import { useAccessStore, useAppConfig, useChatStore } from "@/app/store";

import { ChatOptions, getHeaders, LLMApi, LLMUsage } from "../api";
Expand All @@ -12,6 +16,9 @@ import { prettyObject } from "@/app/utils/format";
export class ChatGPTApi implements LLMApi {
path(path: string): string {
let openaiUrl = useAccessStore.getState().openaiUrl;
if (openaiUrl.length === 0) {
openaiUrl = DEFAULT_API_HOST;
}
if (openaiUrl.endsWith("/")) {
openaiUrl = openaiUrl.slice(0, openaiUrl.length - 1);
}
Expand Down

0 comments on commit 70ea71c

Please sign in to comment.