templates/index.html aktualisiert
This commit is contained in:
@@ -302,21 +302,42 @@
|
||||
}, 60000);
|
||||
});
|
||||
|
||||
// Provider/Model Functions (global)
|
||||
async function updateModelDropdown(isInitialLoad = false) {
|
||||
const provider = document.getElementById('ai-provider').value;
|
||||
const modelSelect = document.getElementById('ai-model');
|
||||
const urlContainer = document.getElementById('ollama-url-container');
|
||||
|
||||
// FIX: Zeige das URL-Feld nur an, wenn Ollama ausgewählt ist
|
||||
if (provider === "ollama") {
|
||||
urlContainer.style.display = "flex";
|
||||
} else {
|
||||
urlContainer.style.display = "none";
|
||||
}
|
||||
|
||||
modelSelect.innerHTML = '<option>Lade Modelle...</option>';
|
||||
|
||||
try {
|
||||
const res = await fetch(`/api/models?provider=${provider}`);
|
||||
const data = await res.json();
|
||||
modelSelect.innerHTML = '';
|
||||
data.models.forEach(m => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = opt.textContent = m;
|
||||
modelSelect.appendChild(opt);
|
||||
});
|
||||
if (isInitialLoad && currentSettings[`${provider}_model`]) modelSelect.value = currentSettings[`${provider}_model`];
|
||||
} catch (e) {}
|
||||
|
||||
if (data.models && data.models.length > 0) {
|
||||
data.models.forEach(m => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = opt.textContent = m;
|
||||
modelSelect.appendChild(opt);
|
||||
});
|
||||
// Setze gespeichertes Modell beim ersten Laden
|
||||
if (isInitialLoad && currentSettings[`${provider}_model`]) {
|
||||
modelSelect.value = currentSettings[`${provider}_model`];
|
||||
}
|
||||
} else {
|
||||
modelSelect.innerHTML = '<option value="">Keine Modelle gefunden</option>';
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Fehler beim Laden der Modelle:", e);
|
||||
modelSelect.innerHTML = '<option value="">Fehler beim Laden</option>';
|
||||
}
|
||||
}
|
||||
|
||||
async function saveSettings() {
|
||||
|
||||
Reference in New Issue
Block a user