diff --git a/packages/tui/src/routes/session/index.tsx b/packages/tui/src/routes/session/index.tsx index e93ec3021fe..32bc3a35edb 100644 --- a/packages/tui/src/routes/session/index.tsx +++ b/packages/tui/src/routes/session/index.tsx @@ -1925,122 +1925,6 @@ function UserMessage(props: { message: SessionMessageUser }) { ) } -function AssistantMessage(props: { message: SessionMessageAssistant; last: boolean }) { - const ctx = use() - const local = useLocal() - const theme = useTheme("elevated") - const model = createMemo( - () => - ctx - .models() - .find((model) => model.providerID === props.message.model.providerID && model.id === props.message.model.id) - ?.name ?? `${props.message.model.providerID}/${props.message.model.id}`, - ) - - const final = createMemo(() => { - return props.message.finish && !["tool-calls", "unknown"].includes(props.message.finish) - }) - - const duration = createMemo(() => { - if (!final()) return 0 - if (!props.message.time.completed) return 0 - return props.message.time.completed - props.message.time.created - }) - - const exploration = createMemo(() => { - const grouped = new Map() - if (!ctx.groupExploration()) return grouped - const runs = props.message.content - .map((part) => - part.type === "tool" && - ["read", "glob", "grep"].includes(toolDisplay(part.name)) && - part.state.status !== "streaming" - ? part - : undefined, - ) - .reduce( - (runs, part) => { - if (part) runs[runs.length - 1].push(part) - if (!part && runs[runs.length - 1].length) runs.push([]) - return runs - }, - [[]], - ) - .filter((run) => run.length > 0) - for (const run of runs) { - const summary = { - parts: run, - active: false, - } - run.forEach((part, index) => grouped.set(part.id, { ...summary, first: index === 0 })) - } - return grouped - }) - - return ( - <> - - {(content, index) => ( - - - - - - - - - - } - > - {(summary) => } - - - - - )} - - - - {errorMessage(props.message.error)} - - - - - - - - - {Locale.titlecase(props.message.agent)} - - · {model()} - - · {Locale.duration(duration())} - - - - - - - ) -} - function AssistantRetry(props: { retry: SessionMessageAssistant["retry"] }) { const theme = useTheme() return ( @@ -2056,40 +1940,6 @@ function AssistantRetry(props: { retry: SessionMessageAssistant["retry"] }) { ) } -function ExplorationSummary(props: { parts: SessionMessageAssistantTool[]; active: boolean }) { - const theme = useTheme() - const pathFormatter = usePathFormatter() - const label = (part: SessionMessageAssistantTool) => { - const input = typeof part.state.input === "string" ? {} : part.state.input - const tool = toolDisplay(part.name) - if (tool === "read") return `Read ${pathFormatter.format(stringValue(input.path))}` - if (tool === "glob") return `Glob "${stringValue(input.pattern)}"` - return `Grep "${stringValue(input.pattern)}"` - } - return ( - - - {props.active ? "Exploring" : "Explored"} - - - {(part, index) => ( - - - {index() === props.parts.length - 1 ? "└" : "├"} {label(part)} - - - )} - - - ) -} - const INLINE_TOOL_ICON_WIDTH = 2 function ReasoningPart(props: {