MCPcopy
hub / github.com/ChatGPTNextWeb/NextChat / path

Method path

app/client/platforms/baidu.ts:48–73  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

46
47export class ErnieApi implements LLMApi {
48 path(path: string): string {
49 const accessStore = useAccessStore.getState();
50
51 let baseUrl = "";
52
53 if (accessStore.useCustomConfig) {
54 baseUrl = accessStore.baiduUrl;
55 }
56
57 if (baseUrl.length === 0) {
58 const isApp = !!getClientConfig()?.isApp;
59 // do not use proxy for baidubce api
60 baseUrl = isApp ? BAIDU_BASE_URL : ApiPath.Baidu;
61 }
62
63 if (baseUrl.endsWith("/")) {
64 baseUrl = baseUrl.slice(0, baseUrl.length - 1);
65 }
66 if (!baseUrl.startsWith("http") && !baseUrl.startsWith(ApiPath.Baidu)) {
67 baseUrl = "https://" + baseUrl;
68 }
69
70 console.log("[Proxy Endpoint] ", baseUrl, path);
71
72 return [baseUrl, path].join("/");
73 }
74
75 speech(options: SpeechOptions): Promise<ArrayBuffer> {
76 throw new Error("Method not implemented.");

Callers 1

chatMethod · 0.95

Calls 1

getClientConfigFunction · 0.90

Tested by

no test coverage detected