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

Method path

app/client/platforms/xai.ts:28–53  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

26 private disableListModels = true;
27
28 path(path: string): string {
29 const accessStore = useAccessStore.getState();
30
31 let baseUrl = "";
32
33 if (accessStore.useCustomConfig) {
34 baseUrl = accessStore.xaiUrl;
35 }
36
37 if (baseUrl.length === 0) {
38 const isApp = !!getClientConfig()?.isApp;
39 const apiPath = ApiPath.XAI;
40 baseUrl = isApp ? XAI_BASE_URL : apiPath;
41 }
42
43 if (baseUrl.endsWith("/")) {
44 baseUrl = baseUrl.slice(0, baseUrl.length - 1);
45 }
46 if (!baseUrl.startsWith("http") && !baseUrl.startsWith(ApiPath.XAI)) {
47 baseUrl = "https://" + baseUrl;
48 }
49
50 console.log("[Proxy Endpoint] ", baseUrl, path);
51
52 return [baseUrl, path].join("/");
53 }
54
55 extractMessage(res: any) {
56 return res.choices?.at(0)?.message?.content ?? "";

Callers 7

chatMethod · 0.95
checkFunction · 0.45
getFunction · 0.45
setFunction · 0.45
checkFunction · 0.45
redisGetFunction · 0.45
redisSetFunction · 0.45

Calls 1

getClientConfigFunction · 0.90

Tested by

no test coverage detected