"use client"; import { useState } from "react"; import { InlineSpinner } from "@/components/inline-spinner"; import { CHOICE_STOP_LABEL, type RectificationChoiceCard as ChoiceCard, } from "@/lib/rectification-agentic/v9/choice-card"; import type { ChoiceKey } from "@/lib/rectification-agentic/v9/choice-card"; type RectificationChoiceCardProps = Readonly<{ card: ChoiceCard; pending: boolean; disabled: boolean; selectedKey?: ChoiceKey | "stop" | "skip_probe" | ""; onSelect: (key: ChoiceKey) => void; onStop: () => void; variant?: "card" | "embedded"; hidePrompt?: boolean; }>; export function RectificationChoiceCard(props: RectificationChoiceCardProps) { const [localSelected, setLocalSelected] = useState(""); const selectedKey = props.selectedKey || localSelected; const answered = Boolean(selectedKey); function select(key: ChoiceKey) { if (props.pending || props.disabled || selectedKey) return; setLocalSelected(key); props.onSelect(key); } function stop() { if (props.pending || props.disabled || selectedKey) return; setLocalSelected("stop"); props.onStop(); } const embedded = props.variant === "embedded"; const hidePrompt = embedded || props.hidePrompt === true; return (
{props.pending && answered ? ( // The tap is being recorded: the same live-row shape as a timeline step, // so the card itself says something is happening.

正在记录…

) : null}
{hidePrompt ? {props.card.prompt} : {props.card.prompt}} {!hidePrompt && props.card.why_user ? (
为什么问这题

{props.card.why_user}

) : null}
{props.card.options.map((option) => ( ))} {props.card.stop_label !== CHOICE_STOP_LABEL ? ( ) : null}
); }