fix: stabilize cockpit and assistant session handoff

This commit is contained in:
chihlasm
2026-04-03 04:00:47 +00:00
parent b07dfb7603
commit ed6e6cd1ed
2 changed files with 44 additions and 16 deletions

View File

@@ -85,6 +85,12 @@ export default function CockpitPage() {
prevMessageCountRef.current = session.messages.length
}, [session.messages.length, showOnboarding])
// Reset local step UI when switching cases or when a new action set arrives.
useEffect(() => {
setActiveStepIndex(0)
setCompletedSteps(new Set())
}, [session.activeChatId, session.activeActions])
// ── Triage handlers ──
const handleTriageFieldSave = useCallback(async (field: keyof TriageMeta, value: string) => {
@@ -306,8 +312,7 @@ export default function CockpitPage() {
<FlowPilotAsks
questions={session.activeQuestions}
onAnswer={(answer) => {
session.setInput(answer)
setTimeout(() => session.handleSend(), 10)
void session.sendMessage(answer, { clearComposer: false })
}}
loading={session.loading}
/>