templates/index.html aktualisiert

This commit is contained in:
2026-03-05 18:55:27 +00:00
parent d837909136
commit a52404bd17

View File

@@ -81,21 +81,37 @@
font-size: 1.2em; font-size: 1.2em;
} }
/* Schriftfarbe und Hintergrund für Dropdowns und Eingabefelder korrigieren */ /* Nur für Dropdowns und Eingabefelder (NICHT für den Button!) */
.toolbar-controls select, .toolbar-controls select,
.toolbar-controls input, .toolbar-controls input {
.toolbar-controls button {
padding: 5px 10px; padding: 5px 10px;
border-radius: 4px; border-radius: 4px;
border: 1px solid #bdc3c7; border: 1px solid #bdc3c7;
color: #2c3e50; /* Dunkle Schriftfarbe! */ color: #2c3e50; /* Dunkle Schrift */
background-color: white; /* Weißer Grund! */ background-color: white; /* Weißer Grund */
font-size: 14px; font-size: 14px;
outline: none;
} }
/* Der Container für die URL (standardmäßig versteckt) */ /* Spezifisches Styling für den Speichern-Button */
.toolbar-controls .save-btn {
background-color: #27ae60;
color: white; /* Weiße Schrift */
border: none;
cursor: pointer;
font-weight: bold;
padding: 6px 15px;
border-radius: 4px;
transition: background 0.2s;
}
.toolbar-controls .save-btn:hover {
background-color: #2ecc71;
}
/* Der Container für die URL */
#ollama-url-container { #ollama-url-container {
display: none; display: none; /* Standardmäßig versteckt */
align-items: center; align-items: center;
gap: 10px; gap: 10px;
margin-left: 10px; margin-left: 10px;
@@ -401,31 +417,41 @@
const modelSelect = document.getElementById('ai-model'); const modelSelect = document.getElementById('ai-model');
const urlContainer = document.getElementById('ollama-url-container'); const urlContainer = document.getElementById('ollama-url-container');
// Dropdown leeren und neu befüllen // 1. Sichtbarkeit sofort umschalten (bevor etwas anderes schiefgehen kann)
modelSelect.innerHTML = '';
modelOptions[provider].forEach(m => {
const opt = document.createElement('option');
opt.value = m;
opt.textContent = m;
modelSelect.appendChild(opt);
});
// Zeige das URL-Feld NUR bei Ollama an
if (provider === "ollama") { if (provider === "ollama") {
urlContainer.style.display = "flex"; urlContainer.style.display = "flex";
} else { } else {
urlContainer.style.display = "none"; urlContainer.style.display = "none";
} }
if (isInitialLoad) { // 2. Dropdown leeren und neu befüllen
modelSelect.innerHTML = '';
// Sicherheitscheck: Gibt es den Provider in unserer Liste?
if (modelOptions[provider]) {
modelOptions[provider].forEach(m => {
const opt = document.createElement('option');
opt.value = m;
opt.textContent = m;
modelSelect.appendChild(opt);
});
}
// 3. Wenn es der Start der Seite ist, setzen wir den gespeicherten Wert
if (isInitialLoad && currentSettings) {
const savedModel = currentSettings[`${provider}_model`]; const savedModel = currentSettings[`${provider}_model`];
// Falls das Modell in der DB ist, aber nicht im Dropdown, fügen wir es als Option hinzu
if (savedModel && !modelOptions[provider].includes(savedModel)) { if (savedModel && !modelOptions[provider].includes(savedModel)) {
const opt = document.createElement('option'); const opt = document.createElement('option');
opt.value = savedModel; opt.value = savedModel;
opt.textContent = savedModel; opt.textContent = savedModel;
modelSelect.appendChild(opt); modelSelect.appendChild(opt);
} }
if (savedModel) modelSelect.value = savedModel;
if (savedModel) {
modelSelect.value = savedModel;
}
} }
} }