Files
archie/ui/src/chat/ChatThinking.vue
T
sam 433ea390a6
Quality / check (pull_request) Canceled after 0s
ci/woodpecker/pr/quality Pipeline was successful
feat(chat): render the live turn's thinking in the dashboard (#1907)
Reasoning frames accumulate into streamingTurn.reasoning and the live row
shows them in a collapsible Thinking trace built from the components/ui
trace pattern, with a spinning icon and shimmering title while no reasoning
has arrived yet. A turn that produces no reasoning renders no trace, and
reasoning never leaks into the reply text.
2026-11-13 00:21:27 +11:00

48 lines
1.4 KiB
Vue

<script setup lang="ts">
import { BrainIcon } from "@lucide/vue";
import { Spinner } from "@/components/ui/spinner";
import {
Trace,
TraceCollapsible,
TraceCollapsibleContent,
TraceCollapsibleTrigger,
TraceIcon,
TraceLine,
TraceTitle,
} from "@/components/ui/trace";
/**
* The live turn's thinking: the model's reasoning as it streams, in the same
* collapsible trace a tool call uses. While the turn has not produced any
* reasoning yet, the icon spins and the title shimmers; once text arrives it
* streams into the open trace. A turn that never reasons renders nothing,
* which the caller decides by not mounting this at all.
*/
withDefaults(
defineProps<{
text?: string;
/** The turn is still arriving and has not reasoned yet. */
pending?: boolean;
}>(),
{ text: "", pending: false },
);
</script>
<template>
<Trace class="my-2">
<TraceCollapsible default-open>
<TraceCollapsibleTrigger>
<TraceLine :status="pending && !text ? 'running' : undefined">
<TraceIcon>
<Spinner v-if="pending && !text" />
<BrainIcon v-else />
</TraceIcon>
<TraceTitle>Thinking</TraceTitle>
</TraceLine>
</TraceCollapsibleTrigger>
<TraceCollapsibleContent v-if="text" class="whitespace-pre-wrap [overflow-wrap:anywhere]">{{ text }}</TraceCollapsibleContent>
</TraceCollapsible>
</Trace>
</template>