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

Method path

app/client/platforms/ai302.ts:46–74  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

44 private disableListModels = false;
45
46 path(path: string): string {
47 const accessStore = useAccessStore.getState();
48
49 let baseUrl = "";
50
51 if (accessStore.useCustomConfig) {
52 baseUrl = accessStore.ai302Url;
53 }
54
55 if (baseUrl.length === 0) {
56 const isApp = !!getClientConfig()?.isApp;
57 const apiPath = ApiPath["302.AI"];
58 baseUrl = isApp ? AI302_BASE_URL : apiPath;
59 }
60
61 if (baseUrl.endsWith("/")) {
62 baseUrl = baseUrl.slice(0, baseUrl.length - 1);
63 }
64 if (
65 !baseUrl.startsWith("http") &&
66 !baseUrl.startsWith(ApiPath["302.AI"])
67 ) {
68 baseUrl = "https://" + baseUrl;
69 }
70
71 console.log("[Proxy Endpoint] ", baseUrl, path);
72
73 return [baseUrl, path].join("/");
74 }
75
76 extractMessage(res: any) {
77 return res.choices?.at(0)?.message?.content ?? "";

Callers 2

chatMethod · 0.95
modelsMethod · 0.95

Calls 1

getClientConfigFunction · 0.90

Tested by

no test coverage detected