|
|
@@ -60,15 +60,23 @@ export class ChatGPTApi implements LLMApi {
|
|
|
path(path: string): string {
|
|
|
const accessStore = useAccessStore.getState();
|
|
|
|
|
|
- const isAzure = accessStore.provider === ServiceProvider.Azure;
|
|
|
+ let baseUrl = "";
|
|
|
|
|
|
- if (isAzure && !accessStore.isValidAzure()) {
|
|
|
- throw Error(
|
|
|
- "incomplete azure config, please check it in your settings page",
|
|
|
- );
|
|
|
- }
|
|
|
+ if (accessStore.useCustomConfig) {
|
|
|
+ const isAzure = accessStore.provider === ServiceProvider.Azure;
|
|
|
|
|
|
- let baseUrl = isAzure ? accessStore.azureUrl : accessStore.openaiUrl;
|
|
|
+ if (isAzure && !accessStore.isValidAzure()) {
|
|
|
+ throw Error(
|
|
|
+ "incomplete azure config, please check it in your settings page",
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isAzure) {
|
|
|
+ path = makeAzurePath(path, accessStore.azureApiVersion);
|
|
|
+ }
|
|
|
+
|
|
|
+ baseUrl = isAzure ? accessStore.azureUrl : accessStore.openaiUrl;
|
|
|
+ }
|
|
|
|
|
|
if (baseUrl.length === 0) {
|
|
|
const isApp = !!getClientConfig()?.isApp;
|
|
|
@@ -84,10 +92,6 @@ export class ChatGPTApi implements LLMApi {
|
|
|
baseUrl = "https://" + baseUrl;
|
|
|
}
|
|
|
|
|
|
- if (isAzure) {
|
|
|
- path = makeAzurePath(path, accessStore.azureApiVersion);
|
|
|
- }
|
|
|
-
|
|
|
console.log("[Proxy Endpoint] ", baseUrl, path);
|
|
|
|
|
|
return [baseUrl, path].join("/");
|