MCPcopy
hub / github.com/marimo-team/marimo / isLastMessageReasoning

Function isLastMessageReasoning

frontend/src/components/chat/chat-utils.ts:58–80  ·  view source on GitHub ↗
(messages: UIMessage[])

Source from the content-addressed store, hash-verified

56}
57
58export function isLastMessageReasoning(messages: UIMessage[]): boolean {
59 if (messages.length === 0) {
60 return false;
61 }
62
63 const lastMessage = messages.at(-1);
64 if (!lastMessage) {
65 return false;
66 }
67
68 if (lastMessage.role !== "assistant" || !lastMessage.parts) {
69 return false;
70 }
71
72 const parts = lastMessage.parts;
73 if (parts.length === 0) {
74 return false;
75 }
76
77 // Check if the last part is reasoning
78 const lastPart = parts[parts.length - 1];
79 return lastPart.type === "reasoning";
80}
81
82function stringifyTextParts(parts: UIMessage["parts"]): string {
83 return parts

Callers 1

ChatPanelBodyFunction · 0.90

Calls 1

atMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…