feat(frontend): store lastUserEntry + stepMessages; record user input/choice

This commit is contained in:
2026-06-29 21:39:02 +02:00
parent 3a97ab3b2f
commit 068c6f197d
4 changed files with 45 additions and 3 deletions
+5
View File
@@ -7,6 +7,7 @@ export function WidgetHost({ sessionId }: { sessionId: string | null }) {
const pending = useSessionStore((s) => s.pendingWidget);
const clearPending = useSessionStore((s) => s.clearPending);
const pushToast = useSessionStore((s) => s.pushToast);
const setLastUserEntry = useSessionStore((s) => s.setLastUserEntry);
if (!pending) return null;
const Renderer = resolve(pending.widget);
const onRespond = async (r: UiResponse) => {
@@ -25,6 +26,10 @@ export function WidgetHost({ sessionId }: { sessionId: string | null }) {
return;
}
}
setLastUserEntry({
kind: "choice",
text: r.text ?? r.choices?.join(", ") ?? r.decision?.type ?? r.control ?? "(choice)",
});
clearPending();
};
return <Renderer descriptor={pending} onRespond={onRespond} />;