diff --git a/src/main.ts b/src/main.ts index 4669621..d4d2b10 100644 --- a/src/main.ts +++ b/src/main.ts @@ -518,7 +518,11 @@ export default function () { } catch (pe) { emit('PROBE_RESULT', { msg: 'example.com UNREACHABLE ยท ' + (pe != null ? (typeof pe === 'string' ? pe : JSON.stringify(pe)) : 'unknown') }) } - const base = payload.baseUrl.replace(/\/+$/, '') + const base = String(payload.baseUrl == null ? '' : payload.baseUrl) + .replace(/`/g, '') // drop stray markdown backticks + .replace(/^@url:\s*/i, '') // drop '@url:' annotation if pasted from chat + .trim() + .replace(/\/+$/, '') // drop trailing slashes const res = await fetch(base + '/models', { headers: { Authorization: 'Bearer ' + payload.apiKey } })