diff --git a/app/api/common.ts b/app/api/common.ts index 125a46fdc..1975adf29 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -50,9 +50,9 @@ export async function requestOpenai( "/api/openai/", "", ); - let baseUrl = isAzure - ? serverConfig.azureUrl - : serverConfig.baseUrl || OPENAI_BASE_URL; + + let baseUrl = + (isAzure ? serverConfig.azureUrl : serverConfig.baseUrl) || OPENAI_BASE_URL; if (!baseUrl.startsWith("http")) { baseUrl = `https://${baseUrl}`; @@ -110,10 +110,9 @@ export async function requestOpenai( } } - // const fetchUrl = `${baseUrl}/${path}`; - const jsonBody = await req.json(); const fetchUrl = cloudflareAIGatewayUrl(`${baseUrl}/${path}`); console.log("fetchUrl", fetchUrl); + const jsonBody = await req.json(); const fetchOptions: RequestInit = { headers: { "Content-Type": "application/json", diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 620bebce9..2152ab397 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -967,290 +967,289 @@ export function Settings() { {/* */} {/* */} - {/* {accessStore.provider === ServiceProvider.OpenAI && (*/} - {/* <>*/} - {/* */} - {/* */} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.openaiUrl = e.currentTarget.value),*/} - {/* )*/} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* {*/} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.openaiApiKey = e.currentTarget.value),*/} - {/* );*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* )}*/} - {/* {accessStore.provider === ServiceProvider.Azure && (*/} - {/* <>*/} - {/* */} - {/* */} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.azureUrl = e.currentTarget.value),*/} - {/* )*/} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* {*/} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.azureApiKey = e.currentTarget.value),*/} - {/* );*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* */} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.azureApiVersion =*/} - {/* e.currentTarget.value),*/} - {/* )*/} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* )}*/} - {/* {accessStore.provider === ServiceProvider.Google && (*/} - {/* <>*/} - {/* */} - {/* */} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.googleUrl = e.currentTarget.value),*/} - {/* )*/} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* {*/} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.googleApiKey = e.currentTarget.value),*/} - {/* );*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* */} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.googleApiVersion =*/} - {/* e.currentTarget.value),*/} - {/* )*/} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* )}*/} - {/* {accessStore.provider === ServiceProvider.Anthropic && (*/} - {/* <>*/} - {/* */} - {/* */} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.anthropicUrl = e.currentTarget.value),*/} - {/* )*/} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* {*/} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.anthropicApiKey =*/} - {/* e.currentTarget.value),*/} - {/* );*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* */} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.anthropicApiVersion =*/} - {/* e.currentTarget.value),*/} - {/* )*/} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* )}*/} - {/* {accessStore.provider === ServiceProvider.Baidu && (*/} - {/* <>*/} - {/* */} - {/* */} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.baiduUrl = e.currentTarget.value),*/} - {/* )*/} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* {*/} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.baiduApiKey = e.currentTarget.value),*/} - {/* );*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* {*/} - {/* accessStore.update(*/} - {/* (access) =>*/} - {/* (access.baiduSecretKey = e.currentTarget.value),*/} - {/* );*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* )}*/} + {/*{accessStore.provider === ServiceProvider.OpenAI && (*/} + {/* <>*/} + {/* */} + {/* */} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.openaiUrl = e.currentTarget.value),*/} + {/* )*/} + {/* }*/} + {/* >*/} + {/* */} + {/* */} + {/* {*/} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.openaiApiKey = e.currentTarget.value),*/} + {/* );*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/*)}*/} + {/*{accessStore.provider === ServiceProvider.Azure && (*/} + {/* <>*/} + {/* */} + {/* */} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.azureUrl = e.currentTarget.value),*/} + {/* )*/} + {/* }*/} + {/* >*/} + {/* */} + {/* */} + {/* {*/} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.azureApiKey = e.currentTarget.value),*/} + {/* );*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* */} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.azureApiVersion =*/} + {/* e.currentTarget.value),*/} + {/* )*/} + {/* }*/} + {/* >*/} + {/* */} + {/* */} + {/*)}*/} + {/*{accessStore.provider === ServiceProvider.Google && (*/} + {/* <>*/} + {/* */} + {/* */} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.googleUrl = e.currentTarget.value),*/} + {/* )*/} + {/* }*/} + {/* >*/} + {/* */} + {/* */} + {/* {*/} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.googleApiKey = e.currentTarget.value),*/} + {/* );*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* */} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.googleApiVersion =*/} + {/* e.currentTarget.value),*/} + {/* )*/} + {/* }*/} + {/* >*/} + {/* */} + {/* */} + {/*)}*/} + {/*{accessStore.provider === ServiceProvider.Anthropic && (*/} + {/* <>*/} + {/* */} + {/* */} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.anthropicUrl = e.currentTarget.value),*/} + {/* )*/} + {/* }*/} + {/* >*/} + {/* */} + {/* */} + {/* {*/} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.anthropicApiKey =*/} + {/* e.currentTarget.value),*/} + {/* );*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* */} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.anthropicApiVersion =*/} + {/* e.currentTarget.value),*/} + {/* )*/} + {/* }*/} + {/* >*/} + {/* */} + {/* */} + {/*)}*/} + {/*{accessStore.provider === ServiceProvider.Baidu && (*/} + {/* <>*/} + {/* */} + {/* */} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.baiduUrl = e.currentTarget.value),*/} + {/* )*/} + {/* }*/} + {/* >*/} + {/* */} + {/* */} + {/* {*/} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.baiduApiKey = e.currentTarget.value),*/} + {/* );*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* {*/} + {/* accessStore.update(*/} + {/* (access) =>*/} + {/* (access.baiduSecretKey = e.currentTarget.value),*/} + {/* );*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/*)}*/} {/* {accessStore.provider === ServiceProvider.ByteDance && (*/} {/* <>*/} diff --git a/app/store/access.ts b/app/store/access.ts index 253d414b9..0683321b5 100644 --- a/app/store/access.ts +++ b/app/store/access.ts @@ -38,7 +38,7 @@ const DEFAULT_ALIBABA_URL = isApp ? DEFAULT_API_HOST + "/api/proxy/alibaba" : ApiPath.Alibaba; -// console.log("DEFAULT_ANTHROPIC_URL", DEFAULT_ANTHROPIC_URL); +console.log("DEFAULT_ANTHROPIC_URL", DEFAULT_ANTHROPIC_URL); const DEFAULT_ACCESS_STATE = { accessCode: "",