feat(admin): Web-Suche pro Nutzer ein-/ausschaltbar
web_search_enabled in AdminUserPrefsUpdate (war nicht im Schema -> wurde wie frueher voice_gender still verworfen) + in der /admin/users-Antwort (Checkbox- Initialzustand, Default = globaler Wert) + Checkbox im Admin-Nutzer-Bereich (speichert sofort). resolve_route respektierte das Pref schon -> wirkt jetzt durchgaengig (AUS = plain Provider, AN = ToolCallingLLM). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
69894b1e7b
commit
5609741039
3 changed files with 25 additions and 0 deletions
|
|
@ -1220,6 +1220,14 @@ function buildUserCard(u) {
|
|||
<div class="lang-allow flex flex-wrap gap-1"></div>
|
||||
</div>
|
||||
|
||||
<!-- Web-Suche (Weg 2) -->
|
||||
<div class="mt-3 pt-3 border-t border-slate-100 dark:border-slate-700">
|
||||
<label class="text-xs text-slate-600 dark:text-slate-300 flex items-center gap-2 cursor-pointer">
|
||||
<input type="checkbox" class="ws-enabled" /> Web-Suche für aktuelle Fragen erlauben
|
||||
<span class="ws-status text-slate-400"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Notfall-Profil -->
|
||||
<div class="mt-3 pt-3 border-t border-slate-100 dark:border-slate-700">
|
||||
<button class="btn-prof text-xs text-slate-500 hover:text-slate-700 dark:hover:text-slate-300 flex items-center gap-1 transition-colors">
|
||||
|
|
@ -1308,6 +1316,21 @@ function buildUserCard(u) {
|
|||
});
|
||||
const consentEl = card.querySelector(".prof-consent");
|
||||
if (consentEl) consentEl.checked = !!u.location_consent;
|
||||
|
||||
// Web-Suche pro Nutzer: sofort speichern bei Änderung
|
||||
const wsEl = card.querySelector(".ws-enabled");
|
||||
const wsStatus = card.querySelector(".ws-status");
|
||||
if (wsEl) {
|
||||
wsEl.checked = !!u.web_search_enabled;
|
||||
wsEl.addEventListener("change", async () => {
|
||||
if (wsStatus) wsStatus.textContent = "speichere …";
|
||||
const res = await adminFetch(`/api/admin/users/${uid}/prefs`, "PUT", { web_search_enabled: wsEl.checked });
|
||||
if (wsStatus) {
|
||||
wsStatus.textContent = res ? "✓" : "Fehler";
|
||||
setTimeout(() => { wsStatus.textContent = ""; }, 2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
const profBtn = card.querySelector(".btn-prof");
|
||||
const profSection = card.querySelector(".prof-section");
|
||||
const profArrow = card.querySelector(".prof-arrow");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue