Unify chat evidence display
This commit is contained in:
@@ -89,9 +89,9 @@ export function AgentMessage({ message, className, ...props }: AgentMessageProps
|
||||
/>
|
||||
</p>
|
||||
{!isUser && message.toolTrace && message.toolTrace.length > 0 && (
|
||||
<AgentToolTracePanel toolTrace={message.toolTrace} />
|
||||
<AgentEvidencePanel sources={message.sources} toolTrace={message.toolTrace} />
|
||||
)}
|
||||
{!isUser && message.sources && message.sources.length > 0 && (
|
||||
{!isUser && (!message.toolTrace || message.toolTrace.length === 0) && message.sources && message.sources.length > 0 && (
|
||||
<AgentSources sources={message.sources} />
|
||||
)}
|
||||
</div>
|
||||
@@ -154,27 +154,47 @@ function AgentSources({ sources }: { sources: AgentSource[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
function AgentToolTracePanel({ toolTrace }: { toolTrace: AgentToolTrace[] }) {
|
||||
function AgentEvidencePanel({
|
||||
sources,
|
||||
toolTrace,
|
||||
}: {
|
||||
sources?: AgentSource[];
|
||||
toolTrace: AgentToolTrace[];
|
||||
}) {
|
||||
const steps = buildReasoningSteps(toolTrace);
|
||||
|
||||
return (
|
||||
<details className="mt-3 rounded-md border bg-muted/30 px-2 py-1.5">
|
||||
<summary className="flex cursor-pointer list-none items-center gap-2 text-xs font-medium text-muted-foreground">
|
||||
<Wrench className="h-3.5 w-3.5" />
|
||||
So wurde gearbeitet ({getToolTraceSummary(toolTrace)})
|
||||
Nachweis & Arbeitsweg ({getToolTraceSummary(toolTrace)})
|
||||
</summary>
|
||||
<div className="mt-2 space-y-2">
|
||||
{steps.map((step, stepIndex) => (
|
||||
<ReasoningStep key={`${step.label}-${stepIndex}`} step={step} />
|
||||
<ReasoningStep
|
||||
key={`${step.label}-${stepIndex}`}
|
||||
sourceId={sources?.[stepIndex]?.id}
|
||||
step={step}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</details>
|
||||
);
|
||||
}
|
||||
|
||||
function ReasoningStep({ step }: { step: AgentReasoningStep }) {
|
||||
function ReasoningStep({
|
||||
sourceId,
|
||||
step,
|
||||
}: {
|
||||
sourceId?: string;
|
||||
step: AgentReasoningStep;
|
||||
}) {
|
||||
return (
|
||||
<div className="rounded-md bg-background/80 p-2 text-xs" data-status={step.status}>
|
||||
<div
|
||||
className="rounded-md bg-background/80 p-2 text-xs"
|
||||
data-source-id={sourceId}
|
||||
data-status={step.status}
|
||||
>
|
||||
<p className="font-medium text-foreground">{step.label}</p>
|
||||
<p className="mt-1 text-muted-foreground">{step.description}</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user