MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / appendTextToBlocks

Function appendTextToBlocks

src/stores/aiChat.ts:672–684  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

670 }
671
672 const appendTextToBlocks = (text: string) => {
673 if (!text) return
674 const idx = getAiMessageIndex()
675 const blocks = targetBuffer.messages[idx].contentBlocks || []
676 const lastBlock = blocks[blocks.length - 1]
677 if (text.trim().length === 0 && (!lastBlock || lastBlock.type !== 'text')) return
678 if (lastBlock && lastBlock.type === 'text') {
679 lastBlock.text += text
680 } else {
681 blocks.push({ type: 'text', text })
682 }
683 updateAIMessage({ contentBlocks: [...blocks], content: targetBuffer.messages[idx].content + text })
684 }
685
686 const appendThinkToBlocks = (text: string, tag?: string, durationMs?: number) => {
687 if (!text && durationMs === undefined) return

Callers 2

sendMessageFunction · 0.85
editCurrentRoundOnlyFunction · 0.85

Calls 1

updateAIMessageFunction · 0.85

Tested by

no test coverage detected