MCPcopy Index your code
hub / github.com/simstudioai/sim / toDisplayBlockBody

Function toDisplayBlockBody

apps/sim/lib/copilot/chat/display-message.ts:66–95  ·  view source on GitHub ↗
(block: PersistedContentBlock)

Source from the content-addressed store, hash-verified

64}
65
66function toDisplayBlockBody(block: PersistedContentBlock): ContentBlock | undefined {
67 switch (block.type) {
68 case MothershipStreamV1EventType.text:
69 if (block.lane === 'subagent') {
70 if (block.channel === 'thinking') {
71 return { type: ContentBlockType.subagent_thinking, content: block.content }
72 }
73 return { type: ContentBlockType.subagent_text, content: block.content }
74 }
75 if (block.channel === 'thinking') {
76 return { type: ContentBlockType.thinking, content: block.content }
77 }
78 return { type: ContentBlockType.text, content: block.content }
79 case MothershipStreamV1EventType.tool:
80 if (!toToolCallInfo(block)) return undefined
81 return { type: ContentBlockType.tool_call, toolCall: toToolCallInfo(block) }
82 case MothershipStreamV1EventType.span:
83 if (block.lifecycle === MothershipStreamV1SpanLifecycleEvent.end) {
84 return { type: ContentBlockType.subagent_end }
85 }
86 return { type: ContentBlockType.subagent, content: block.content }
87 case MothershipStreamV1EventType.complete:
88 if (block.status === MothershipStreamV1CompletionStatus.cancelled) {
89 return { type: ContentBlockType.stopped }
90 }
91 return { type: ContentBlockType.text, content: block.content }
92 default:
93 return { type: ContentBlockType.text, content: block.content }
94 }
95}
96
97function toDisplayAttachment(f: PersistedMessage['fileAttachments']): ChatMessageAttachment[] {
98 if (!f || f.length === 0) return []

Callers 1

toDisplayBlockFunction · 0.85

Calls 1

toToolCallInfoFunction · 0.85

Tested by

no test coverage detected