(text: string)
| 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 |
no test coverage detected