Merge remote-tracking branch 'upstream/main' into dev

# Conflicts:
#	app/api/common.ts
#	app/components/settings.tsx
#	app/store/access.ts
This commit is contained in:
sijinhui 2024-07-17 12:58:32 +08:00
commit c53ee2f065
3 changed files with 288 additions and 290 deletions

View File

@ -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",

View File

@ -967,7 +967,7 @@ export function Settings() {
{/* </Select>*/}
{/* </ListItem>*/}
{/* {accessStore.provider === ServiceProvider.OpenAI && (*/}
{/*{accessStore.provider === ServiceProvider.OpenAI && (*/}
{/* <>*/}
{/* <ListItem*/}
{/* title={Locale.Settings.Access.OpenAI.Endpoint.Title}*/}
@ -1006,8 +1006,8 @@ export function Settings() {
{/* />*/}
{/* </ListItem>*/}
{/* </>*/}
{/* )}*/}
{/* {accessStore.provider === ServiceProvider.Azure && (*/}
{/*)}*/}
{/*{accessStore.provider === ServiceProvider.Azure && (*/}
{/* <>*/}
{/* <ListItem*/}
{/* title={Locale.Settings.Access.Azure.Endpoint.Title}*/}
@ -1066,8 +1066,8 @@ export function Settings() {
{/* ></input>*/}
{/* </ListItem>*/}
{/* </>*/}
{/* )}*/}
{/* {accessStore.provider === ServiceProvider.Google && (*/}
{/*)}*/}
{/*{accessStore.provider === ServiceProvider.Google && (*/}
{/* <>*/}
{/* <ListItem*/}
{/* title={Locale.Settings.Access.Google.Endpoint.Title}*/}
@ -1126,8 +1126,8 @@ export function Settings() {
{/* ></input>*/}
{/* </ListItem>*/}
{/* </>*/}
{/* )}*/}
{/* {accessStore.provider === ServiceProvider.Anthropic && (*/}
{/*)}*/}
{/*{accessStore.provider === ServiceProvider.Anthropic && (*/}
{/* <>*/}
{/* <ListItem*/}
{/* title={Locale.Settings.Access.Anthropic.Endpoint.Title}*/}
@ -1189,14 +1189,13 @@ export function Settings() {
{/* ></input>*/}
{/* </ListItem>*/}
{/* </>*/}
{/* )}*/}
{/* {accessStore.provider === ServiceProvider.Baidu && (*/}
{/*)}*/}
{/*{accessStore.provider === ServiceProvider.Baidu && (*/}
{/* <>*/}
{/* <ListItem*/}
{/* title={Locale.Settings.Access.Baidu.Endpoint.Title}*/}
{/* subTitle={*/}
{/* Locale.Settings.Access.Anthropic.Endpoint.SubTitle +*/}
{/* Baidu.ExampleEndpoint*/}
{/* Locale.Settings.Access.Baidu.Endpoint.SubTitle*/}
{/* }*/}
{/* >*/}
{/* <input*/}
@ -1250,7 +1249,7 @@ export function Settings() {
{/* />*/}
{/* </ListItem>*/}
{/* </>*/}
{/* )}*/}
{/*)}*/}
{/* {accessStore.provider === ServiceProvider.ByteDance && (*/}
{/* <>*/}

View File

@ -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: "",