(input: string)
| 71 | } |
| 72 | |
| 73 | function normalizeBaseUrl(input: string): string { |
| 74 | let baseUrl = input |
| 75 | while (baseUrl.endsWith("/")) { |
| 76 | baseUrl = baseUrl.slice(0, -1) |
| 77 | } |
| 78 | if ( |
| 79 | (baseUrl.startsWith("https://chatgpt.com") || baseUrl.startsWith("https://chat.openai.com")) && |
| 80 | !baseUrl.includes("/backend-api") |
| 81 | ) { |
| 82 | baseUrl = `${baseUrl}/backend-api` |
| 83 | } |
| 84 | return baseUrl |
| 85 | } |
| 86 | |
| 87 | function issuerPath(path: string): string { |
| 88 | const base = Config.issuerBaseUrl.replace(/\/$/, "") |