(path: string)
| 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.siliconflowUrl; |
| 53 | } |
| 54 | |
| 55 | if (baseUrl.length === 0) { |
| 56 | const isApp = !!getClientConfig()?.isApp; |
| 57 | const apiPath = ApiPath.SiliconFlow; |
| 58 | baseUrl = isApp ? SILICONFLOW_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.SiliconFlow) |
| 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 ?? ""; |
no test coverage detected