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.
48 lines
1.4 KiB
Vue
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>
|