Files
homeai/homeai-dashboard/src/hooks/usePromptStyle.js
Aodhan Collins 56580a2cb2 feat: memory v2, prompt styles, Dream/GAZE integration, Wyoming TTS fix
SQLite + sqlite-vec replaces JSON memory files with semantic search,
follow-up injection, privacy levels, and lifecycle management.

Six prompt styles (quick/standard/creative/roleplayer/game-master/storyteller)
with per-style Claude model tiering (Haiku/Sonnet/Opus), temperature control,
and section stripping. Characters can set default style and per-style overrides.

Dream character import and GAZE character linking in the dashboard editor
with auto-populated fields, cover image resolution, and preset assignment.

Bridge: session isolation (conversation_id / 12h satellite buckets),
model routing refactor, PUT/DELETE support, memory REST endpoints.

Dashboard: mobile-responsive sidebar, retry button, style picker in chat,
follow-up banner, memory lifecycle/privacy UI, cloud model options in editor.

Wyoming TTS: upgraded to v1.8.0 for HA 1.7.2 compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 22:31:04 +00:00

35 lines
1000 B
JavaScript

import { useState, useEffect, useCallback } from 'react'
import { getPromptStyles, getActiveStyle, setActiveStyle } from '../lib/api'
export function usePromptStyle() {
const [styles, setStyles] = useState([])
const [activeStyle, setActive] = useState('standard')
const [isLoading, setIsLoading] = useState(true)
useEffect(() => {
let cancelled = false
Promise.all([getPromptStyles(), getActiveStyle()])
.then(([allStyles, active]) => {
if (cancelled) return
setStyles(allStyles)
setActive(active.style || 'standard')
setIsLoading(false)
})
.catch(() => {
if (!cancelled) setIsLoading(false)
})
return () => { cancelled = true }
}, [])
const selectStyle = useCallback(async (styleId) => {
setActive(styleId)
try {
await setActiveStyle(styleId)
} catch (err) {
console.error('Failed to set prompt style:', err)
}
}, [])
return { styles, activeStyle, selectStyle, isLoading }
}