import { Collapse, Tag } from 'antd'; import type { RetrievedSnippet, ToolCallTrace } from '../../../../api'; import Markdown from '../../../../components/Markdown'; export function ReasoningView({ reasoning }: { reasoning: string }) { return ( 🧠 推理过程, children: (
{reasoning}
) } ]} /> ); } export function RetrievedView({ retrieved }: { retrieved: RetrievedSnippet[] }) { return ( 🔍 RAG 命中片段 ({retrieved.length}), children: (
{retrieved.map((r, i) => (
📄 {r.fileName} · 切片#{r.chunkIndex} · score {r.score.toFixed(3)}
{r.preview} {r.preview.length >= 200 ? '…' : ''}
))}
) } ]} /> ); } export function ToolCallView({ calls, liveStyle }: { calls: ToolCallTrace[]; liveStyle?: boolean }) { return ( 🛠 工具调用 ({calls.length}), children: (
{calls.map((t, i) => { const isPending = (t.result as any)?.pending; const isFailed = t.result?.ok === false; return (
⚙️ {t.name} {isPending && 运行中…} {!isPending && t.result?.durationMs != null && {t.result.durationMs}ms} {isFailed && 失败}
args: {JSON.stringify(t.args)}
{!isPending && (
result:{' '} {JSON.stringify(t.result?.result ?? t.result?.error ?? t.result).slice(0, 500)}
)}
); })}
) } ]} /> ); }