Merge pull request #124 from sijinhui/dev

Dev
This commit is contained in:
sijinhui 2024-07-17 13:00:35 +08:00 committed by GitHub
commit ef013634ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 287 additions and 289 deletions

View File

@ -50,9 +50,9 @@ export async function requestOpenai(
"/api/openai/", "/api/openai/",
"", "",
); );
let baseUrl = isAzure
? serverConfig.azureUrl let baseUrl =
: serverConfig.baseUrl || OPENAI_BASE_URL; (isAzure ? serverConfig.azureUrl : serverConfig.baseUrl) || OPENAI_BASE_URL;
if (!baseUrl.startsWith("http")) { if (!baseUrl.startsWith("http")) {
baseUrl = `https://${baseUrl}`; 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}`); const fetchUrl = cloudflareAIGatewayUrl(`${baseUrl}/${path}`);
console.log("fetchUrl", fetchUrl); console.log("fetchUrl", fetchUrl);
const jsonBody = await req.json();
const fetchOptions: RequestInit = { const fetchOptions: RequestInit = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",

View File

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