update notification service

This commit is contained in:
MacRimi
2026-03-27 20:31:21 +01:00
parent 8ed500adf7
commit 976f23a90e
2 changed files with 35 additions and 37 deletions
+13 -15
View File
@@ -550,7 +550,7 @@ export function NotificationSettings() {
ai_openai_base_url: cfg.ai_openai_base_url, ai_openai_base_url: cfg.ai_openai_base_url,
ai_prompt_mode: cfg.ai_prompt_mode || "default", ai_prompt_mode: cfg.ai_prompt_mode || "default",
ai_custom_prompt: cfg.ai_custom_prompt || "", ai_custom_prompt: cfg.ai_custom_prompt || "",
ai_allow_suggestions: cfg.ai_allow_suggestions || "false", ai_allow_suggestions: String(cfg.ai_allow_suggestions === "true" || cfg.ai_allow_suggestions === true),
hostname: cfg.hostname, hostname: cfg.hostname,
webhook_secret: cfg.webhook_secret, webhook_secret: cfg.webhook_secret,
webhook_allowed_ips: cfg.webhook_allowed_ips, webhook_allowed_ips: cfg.webhook_allowed_ips,
@@ -1852,16 +1852,15 @@ export function NotificationSettings() {
</div> </div>
{/* Experimental: AI Suggestions toggle */} {/* Experimental: AI Suggestions toggle */}
<div className="mt-3 p-4 rounded-lg bg-muted/30 border border-border/50"> <div className="flex items-center justify-between pt-3 border-t border-border/50">
<div className="flex items-center justify-between">
<div className="flex items-start gap-3"> <div className="flex items-start gap-3">
<Lightbulb className="h-5 w-5 text-yellow-400 mt-0.5 shrink-0" /> <Lightbulb className="h-5 w-5 text-purple-400 mt-0.5 shrink-0" />
<div> <div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="text-sm font-medium">AI Suggestions</span> <span className="text-sm font-medium">AI Suggestions</span>
<span className="text-[10px] px-1.5 py-0.5 rounded bg-yellow-500/20 text-yellow-400 font-medium">BETA</span> <span className="text-[10px] px-1.5 py-0.5 rounded bg-purple-500/20 text-purple-400 font-medium">BETA</span>
</div> </div>
<p className="text-xs sm:text-sm text-muted-foreground mt-1"> <p className="text-xs sm:text-sm text-muted-foreground">
Allow AI to add brief troubleshooting tips based on log context Allow AI to add brief troubleshooting tips based on log context
</p> </p>
</div> </div>
@@ -1869,9 +1868,9 @@ export function NotificationSettings() {
<button <button
className={`relative w-9 h-[18px] rounded-full transition-colors ${ className={`relative w-9 h-[18px] rounded-full transition-colors ${
config.ai_allow_suggestions === "true" || config.ai_allow_suggestions === true config.ai_allow_suggestions === "true" || config.ai_allow_suggestions === true
? "bg-blue-500" ? "bg-purple-600"
: "bg-muted-foreground/30" : "bg-muted-foreground/20 border border-muted-foreground/40"
} ${!editMode ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`} } ${!editMode ? "opacity-60 cursor-not-allowed" : "cursor-pointer"}`}
onClick={() => { onClick={() => {
if (editMode) { if (editMode) {
const newValue = config.ai_allow_suggestions === "true" || config.ai_allow_suggestions === true ? "false" : "true" const newValue = config.ai_allow_suggestions === "true" || config.ai_allow_suggestions === true ? "false" : "true"
@@ -1879,16 +1878,15 @@ export function NotificationSettings() {
} }
}} }}
disabled={!editMode} disabled={!editMode}
role="switch"
aria-checked={config.ai_allow_suggestions === "true" || config.ai_allow_suggestions === true}
> >
<span <span className={`absolute top-[1px] left-[1px] h-4 w-4 rounded-full bg-white shadow transition-transform ${
className={`absolute top-0.5 left-0.5 h-3.5 w-3.5 rounded-full bg-white transition-transform ${ config.ai_allow_suggestions === "true" || config.ai_allow_suggestions === true ? "translate-x-[18px]" : "translate-x-0"
config.ai_allow_suggestions === "true" || config.ai_allow_suggestions === true ? "translate-x-[18px]" : "" }`} />
}`}
/>
</button> </button>
</div> </div>
</div> </div>
</div>
)} )}
{/* Custom mode: Editable prompt textarea */} {/* Custom mode: Editable prompt textarea */}
+2 -2
View File
@@ -1325,9 +1325,9 @@ class HealthPersistence:
print(f"[HealthPersistence] Error recording UNKNOWN persistent: {e}") print(f"[HealthPersistence] Error recording UNKNOWN persistent: {e}")
# ───────────────────────────────────────────────────────────────
# Disk Observations API
# ──────────────────────────────────────────────────────────────── # ────────────────────────────────────────────────────────────────
# Disk Observations API
# ───────────────────────────────────────────────────────────────
def register_disk(self, device_name: str, serial: Optional[str] = None, def register_disk(self, device_name: str, serial: Optional[str] = None,
model: Optional[str] = None, size_bytes: Optional[int] = None): model: Optional[str] = None, size_bytes: Optional[int] = None):