fix: validate Ollama URL protocol before fetching api/tags
This commit is contained in:
@@ -36,7 +36,9 @@ async function loadDevices() {
|
||||
|
||||
async function loadOllamaModels(baseUrl, current) {
|
||||
try {
|
||||
const r = await fetch(baseUrl + '/api/tags');
|
||||
const parsed = new URL(baseUrl);
|
||||
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return;
|
||||
const r = await fetch(parsed.origin + '/api/tags');
|
||||
if (!r.ok) return;
|
||||
const data = await r.json();
|
||||
const sel = document.getElementById('ollama-model');
|
||||
|
||||
Reference in New Issue
Block a user