Combines homeai-character (service status, character profiles, editor) and homeai-desktop (chat with voice I/O) into homeai-dashboard on port 5173. - 4-page sidebar layout: Dashboard, Chat, Characters, Editor - Merged Vite middleware: health checks, service restart, bridge proxy - Bridge upgraded to ThreadingHTTPServer (fixes LAN request queuing) - TTS strips emojis before synthesis - Updated start.sh with new launchd service names - Added preload-models to startup sequence Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
735 B
JavaScript
28 lines
735 B
JavaScript
import { useState, useCallback } from 'react'
|
|
import { DEFAULT_SETTINGS } from '../lib/constants'
|
|
|
|
const STORAGE_KEY = 'homeai_dashboard_settings'
|
|
|
|
function loadSettings() {
|
|
try {
|
|
const stored = localStorage.getItem(STORAGE_KEY)
|
|
return stored ? { ...DEFAULT_SETTINGS, ...JSON.parse(stored) } : { ...DEFAULT_SETTINGS }
|
|
} catch {
|
|
return { ...DEFAULT_SETTINGS }
|
|
}
|
|
}
|
|
|
|
export function useSettings() {
|
|
const [settings, setSettings] = useState(loadSettings)
|
|
|
|
const updateSetting = useCallback((key, value) => {
|
|
setSettings((prev) => {
|
|
const next = { ...prev, [key]: value }
|
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(next))
|
|
return next
|
|
})
|
|
}, [])
|
|
|
|
return { settings, updateSetting }
|
|
}
|