support cloudflare ai gateway

This commit is contained in:
lloydzhou
2024-07-12 12:00:25 +08:00
parent 89049e1a22
commit 728c38396a
5 changed files with 49 additions and 15 deletions

View File

@@ -11,6 +11,7 @@ import {
} from "@/app/constant";
import { useAccessStore, useAppConfig, useChatStore } from "@/app/store";
import { collectModelsWithDefaultModel } from "@/app/utils/model";
import { cloudflareAIGatewayUrl } from "@/app/utils/cloudflare";
import {
ChatOptions,
@@ -94,7 +95,8 @@ export class ChatGPTApi implements LLMApi {
console.log("[Proxy Endpoint] ", baseUrl, path);
return [baseUrl, path].join("/");
// try rebuild url, when using cloudflare ai gateway in client
return cloudflareAIGatewayUrl([baseUrl, path].join("/"));
}
extractMessage(res: any) {