This commit is contained in:
lloydzhou 2024-08-01 19:02:40 +08:00
parent c359b92ddc
commit dfc36e5210
1 changed files with 4 additions and 9 deletions

View File

@ -1,10 +1,5 @@
"use client"; "use client";
import { import { ApiPath, DEFAULT_API_HOST, REQUEST_TIMEOUT_MS } from "@/app/constant";
ApiPath,
DEFAULT_API_HOST,
REQUEST_TIMEOUT_MS,
Tencent,
} from "@/app/constant";
import { useAccessStore, useAppConfig, useChatStore } from "@/app/store"; import { useAccessStore, useAppConfig, useChatStore } from "@/app/store";
import { import {
@ -67,7 +62,7 @@ function capitalizeKeys(obj: any): any {
} }
export class HunyuanApi implements LLMApi { export class HunyuanApi implements LLMApi {
path(path: string): string { path(): string {
const accessStore = useAccessStore.getState(); const accessStore = useAccessStore.getState();
let baseUrl = ""; let baseUrl = "";
@ -79,7 +74,7 @@ export class HunyuanApi implements LLMApi {
if (baseUrl.length === 0) { if (baseUrl.length === 0) {
const isApp = !!getClientConfig()?.isApp; const isApp = !!getClientConfig()?.isApp;
baseUrl = isApp baseUrl = isApp
? DEFAULT_API_HOST + "/api/proxy/bytedance" ? DEFAULT_API_HOST + "/api/proxy/tencent"
: ApiPath.Tencent; : ApiPath.Tencent;
} }
@ -128,7 +123,7 @@ export class HunyuanApi implements LLMApi {
options.onController?.(controller); options.onController?.(controller);
try { try {
const chatPath = this.path(Tencent.ChatPath); const chatPath = this.path();
const chatPayload = { const chatPayload = {
method: "POST", method: "POST",
body: JSON.stringify(requestPayload), body: JSON.stringify(requestPayload),