templates/index.html aktualisiert
This commit is contained in:
@@ -302,21 +302,42 @@
|
|||||||
}, 60000);
|
}, 60000);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Provider/Model Functions (global)
|
|
||||||
async function updateModelDropdown(isInitialLoad = false) {
|
async function updateModelDropdown(isInitialLoad = false) {
|
||||||
const provider = document.getElementById('ai-provider').value;
|
const provider = document.getElementById('ai-provider').value;
|
||||||
const modelSelect = document.getElementById('ai-model');
|
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 {
|
try {
|
||||||
const res = await fetch(`/api/models?provider=${provider}`);
|
const res = await fetch(`/api/models?provider=${provider}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
modelSelect.innerHTML = '';
|
modelSelect.innerHTML = '';
|
||||||
|
|
||||||
|
if (data.models && data.models.length > 0) {
|
||||||
data.models.forEach(m => {
|
data.models.forEach(m => {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = opt.textContent = m;
|
opt.value = opt.textContent = m;
|
||||||
modelSelect.appendChild(opt);
|
modelSelect.appendChild(opt);
|
||||||
});
|
});
|
||||||
if (isInitialLoad && currentSettings[`${provider}_model`]) modelSelect.value = currentSettings[`${provider}_model`];
|
// Setze gespeichertes Modell beim ersten Laden
|
||||||
} catch (e) {}
|
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() {
|
async function saveSettings() {
|
||||||
|
|||||||
Reference in New Issue
Block a user