fix(client): keep compact row in conversation package
This commit is contained in:
@@ -3,11 +3,9 @@
|
|||||||
// generic command card so no-history, cancellation, and failures retain their
|
// generic command card so no-history, cancellation, and failures retain their
|
||||||
// complete handler-authored text.
|
// complete handler-authored text.
|
||||||
|
|
||||||
import { IconApiOutline14 } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
||||||
import type { ChatViewSlotProps, CommandRowOwnerProps } from '../contract/slots.ts'
|
import type { ChatViewSlotProps, CommandRowOwnerProps } from '../contract/slots.ts'
|
||||||
import { CompactionItem } from './CompactionItem.tsx'
|
import { CompactionItem } from './CompactionItem.tsx'
|
||||||
import { GenericCommandCard } from './GenericCommandCard.tsx'
|
import { GenericCommandCard } from './GenericCommandCard.tsx'
|
||||||
import { ToolRow } from './ToolRow.tsx'
|
|
||||||
|
|
||||||
interface CompactionCommandCardProps extends CommandRowOwnerProps {
|
interface CompactionCommandCardProps extends CommandRowOwnerProps {
|
||||||
t: ChatViewSlotProps['t']
|
t: ChatViewSlotProps['t']
|
||||||
@@ -26,15 +24,5 @@ export function CompactionCommandCard({ node, compaction, t }: CompactionCommand
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (node.outcome !== null) return <GenericCommandCard node={node} t={t} />
|
if (node.outcome !== null) return <GenericCommandCard node={node} t={t} />
|
||||||
return (
|
return <GenericCommandCard node={node} t={t} runningSummary={t('message.compaction.running')} />
|
||||||
<ToolRow
|
|
||||||
t={t}
|
|
||||||
variant="others"
|
|
||||||
icon={<IconApiOutline14 size={14} />}
|
|
||||||
title="compact"
|
|
||||||
summary={t('message.compaction.running')}
|
|
||||||
body={null}
|
|
||||||
state="running"
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,13 +25,15 @@ function leadingFor(state: CommandRowState): ReactNode {
|
|||||||
/** Card props: the owner payload plus the render site's locale seat (plain prop). */
|
/** Card props: the owner payload plus the render site's locale seat (plain prop). */
|
||||||
export interface GenericCommandCardProps extends CommandRowOwnerProps {
|
export interface GenericCommandCardProps extends CommandRowOwnerProps {
|
||||||
t: ChatViewSlotProps['t']
|
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 [expanded, setExpanded] = useState(false)
|
||||||
const text = node.outcome?.text
|
const text = node.outcome?.text
|
||||||
const summary = node.outcome === null
|
const summary = node.outcome === null
|
||||||
? t('command.running')
|
? runningSummary ?? t('command.running')
|
||||||
: text ?? (node.outcome.kind === 'error' ? t('command.failed') : t('command.done'))
|
: text ?? (node.outcome.kind === 'error' ? t('command.failed') : t('command.done'))
|
||||||
// Title is the bare command name: the row already reads `name · outcome`,
|
// Title is the bare command name: the row already reads `name · outcome`,
|
||||||
// and the dispatched line's own `/` and arguments only restate what the
|
// and the dispatched line's own `/` and arguments only restate what the
|
||||||
|
|||||||
Reference in New Issue
Block a user