({ steps }: { steps: ProcessStep[] })
| 2168 | } |
| 2169 | |
| 2170 | function ProcessPanel({ steps }: { steps: ProcessStep[] }) { |
| 2171 | const { t } = useI18n(); |
| 2172 | if (steps.length === 0) { |
| 2173 | return <EmptyState title={t("还没有搜索过程", "No search trace yet")} description={t("每次对话或检索都会清空这里,并展示新的执行链路。", "Each chat or search clears this panel and shows the latest execution trace.")} />; |
| 2174 | } |
| 2175 | |
| 2176 | return ( |
| 2177 | <div className="space-y-2"> |
| 2178 | {steps.map((step, index) => ( |
| 2179 | <Card key={step.id} className={cn(step.status === "failed" && "border-red-200 bg-red-50/60")}> |
| 2180 | <CardContent className="space-y-2"> |
| 2181 | <div className="flex items-start justify-between gap-3"> |
| 2182 | <div className="min-w-0"> |
| 2183 | <div className="flex items-center gap-2"> |
| 2184 | <span className="flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] text-muted-foreground"> |
| 2185 | {index + 1} |
| 2186 | </span> |
| 2187 | <div className="truncate text-sm font-semibold">{step.title}</div> |
| 2188 | </div> |
| 2189 | {step.detail ? ( |
| 2190 | <div className="mt-1 pl-7 text-xs leading-5 text-muted-foreground">{step.detail}</div> |
| 2191 | ) : null} |
| 2192 | </div> |
| 2193 | <Badge className={processStatusClassName(step.status)}> |
| 2194 | {step.status === "running" ? <Loader2 className="mr-1 h-3 w-3 animate-spin" /> : null} |
| 2195 | {processStatusLabel(step.status, t)} |
| 2196 | </Badge> |
| 2197 | </div> |
| 2198 | {step.durationMs != null ? ( |
| 2199 | <div className="pl-7 text-xs text-muted-foreground">{t(`耗时:${step.durationMs} 毫秒`, `Duration: ${step.durationMs} ms`)}</div> |
| 2200 | ) : null} |
| 2201 | {step.payload !== undefined ? ( |
| 2202 | <div className="pl-7"> |
| 2203 | <JsonBlock title={t("数据", "Data")} value={step.payload} compact /> |
| 2204 | </div> |
| 2205 | ) : null} |
| 2206 | </CardContent> |
| 2207 | </Card> |
| 2208 | ))} |
| 2209 | </div> |
| 2210 | ); |
| 2211 | } |
| 2212 | |
| 2213 | function RawLogsPanel(props: { |
| 2214 | logs: ModelCallLogRecord[]; |
nothing calls this directly
no test coverage detected