fix(client): keep compact row in conversation package

This commit is contained in:
imccyu
2026-08-08 16:43:29 +08:00
parent 810bfc4b5e
commit c5b37f6845
2 changed files with 5 additions and 15 deletions

View File

@@ -3,11 +3,9 @@
// generic command card so no-history, cancellation, and failures retain their
// complete handler-authored text.
import { IconApiOutline14 } from '@deepseek-ai/dsh-client-ui-primitives'
import type { ChatViewSlotProps, CommandRowOwnerProps } from '../contract/slots.ts'
import { CompactionItem } from './CompactionItem.tsx'
import { GenericCommandCard } from './GenericCommandCard.tsx'
import { ToolRow } from './ToolRow.tsx'
interface CompactionCommandCardProps extends CommandRowOwnerProps {
t: ChatViewSlotProps['t']
@@ -26,15 +24,5 @@ export function CompactionCommandCard({ node, compaction, t }: CompactionCommand
)
}
if (node.outcome !== null) return <GenericCommandCard node={node} t={t} />
return (
<ToolRow
t={t}
variant="others"
icon={<IconApiOutline14 size={14} />}
title="compact"
summary={t('message.compaction.running')}
body={null}
state="running"
/>
)
return <GenericCommandCard node={node} t={t} runningSummary={t('message.compaction.running')} />
}

View File

@@ -25,13 +25,15 @@ function leadingFor(state: CommandRowState): ReactNode {
/** Card props: the owner payload plus the render site's locale seat (plain prop). */
export interface GenericCommandCardProps extends CommandRowOwnerProps {
t: ChatViewSlotProps['t']
/** Command-specific running copy; absent uses the generic command label. */
runningSummary?: string | undefined
}
export function GenericCommandCard({ node, t }: GenericCommandCardProps) {
export function GenericCommandCard({ node, t, runningSummary }: GenericCommandCardProps) {
const [expanded, setExpanded] = useState(false)
const text = node.outcome?.text
const summary = node.outcome === null
? t('command.running')
? runningSummary ?? t('command.running')
: text ?? (node.outcome.kind === 'error' ? t('command.failed') : t('command.done'))
// Title is the bare command name: the row already reads `name · outcome`,
// and the dispatched line's own `/` and arguments only restate what the