Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface MessageActionsProps {
getCopyContent?: () => string
hasCopyContent?: boolean
prepareContentForCopy?: (content: string) => ClipboardContent
userQuery?: string
userQuery: string | undefined
requestId?: string
messageId?: string
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ interface AssistantMessageRowProps {
prepareContentForCopy: (content: string) => ClipboardContent
isStreaming: boolean
isLast: boolean
precedingUserContent: string | undefined
/** Transcript-derived answers for this message's question card (renders the recap). */
questionAnswers?: string[]
/** Transcript-derived status payload for this message's credential card. */
Expand All @@ -227,6 +228,7 @@ const AssistantMessageRow = memo(function AssistantMessageRow({
prepareContentForCopy,
isStreaming,
isLast,
precedingUserContent,
questionAnswers,
credentialSubmission,
credentialAbandoned,
Expand Down Expand Up @@ -311,6 +313,7 @@ const AssistantMessageRow = memo(function AssistantMessageRow({
getCopyContent={getCopyContent}
hasCopyContent={Boolean(getOrchestratorMessageText(blocks, message.content).trim())}
prepareContentForCopy={prepareContentForCopy}
userQuery={precedingUserContent}
requestId={message.requestId}
messageId={message.id}
/>
Expand Down Expand Up @@ -562,6 +565,16 @@ export function MothershipChat({
return out
}, [messages])

const precedingUserContentByIndex = useMemo(() => {
const out: Array<string | undefined> = []
let lastUserContent: string | undefined
for (const [index, message] of messages.entries()) {
out[index] = lastUserContent
if (message.role === 'user') lastUserContent = message.content
}
return out
}, [messages])

/**
* Pairs each assistant question/credential card with the user message that
* completed it. The paired user message is hidden — the answered card IS the
Expand Down Expand Up @@ -809,6 +822,7 @@ export function MothershipChat({
prepareContentForCopy={prepareContentForCopy}
isStreaming={isStreamActive && isLast}
isLast={isLast}
precedingUserContent={precedingUserContentByIndex[index]}
questionAnswers={interactionPairing.answersByIndex[index]}
credentialSubmission={interactionPairing.credentialSubmissionByIndex[index]}
credentialAbandoned={interactionPairing.credentialAbandonedByIndex[index]}
Expand Down
Loading