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) {
|
async function loadOllamaModels(baseUrl, current) {
|
||||||
try {
|
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;
|
if (!r.ok) return;
|
||||||
const data = await r.json();
|
const data = await r.json();
|
||||||
const sel = document.getElementById('ollama-model');
|
const sel = document.getElementById('ollama-model');
|
||||||
|
|||||||
Reference in New Issue
Block a user