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

Function normalizeBlocks

apps/sim/lib/copilot/chat/persisted-message.ts:584–600  ·  view source on GitHub ↗
(rawBlocks: RawBlock[], messageContent: string)

Source from the content-addressed store, hash-verified

582}
583
584function normalizeBlocks(rawBlocks: RawBlock[], messageContent: string): PersistedContentBlock[] {
585 const blocks = rawBlocks.map(normalizeBlock)
586 const hasAssistantText = blocks.some(
587 (b) =>
588 b.type === MothershipStreamV1EventType.text &&
589 b.channel !== MothershipStreamV1TextChannel.thinking &&
590 b.content?.trim()
591 )
592 if (!hasAssistantText && messageContent.trim()) {
593 blocks.push({
594 type: MothershipStreamV1EventType.text,
595 channel: MothershipStreamV1TextChannel.assistant,
596 content: messageContent,
597 })
598 }
599 return blocks
600}
601
602export function normalizeMessage(raw: Record<string, unknown>): PersistedMessage {
603 const msg: PersistedMessage = {

Callers 1

normalizeMessageFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected