fix: sanitize provider baseUrl in main thread — strip stray '@url:' annotation and markdown backticks pasted from chat (was producing invalid fetch URLs); bump 0.1.14
This commit is contained in:
1 parent
02ba14b791
commit
901d75391e
1 file changed
+5
-1
+5
-1
@@ -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 }
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user