(
res: Response,
state: { blockIndex: number; textBlockStarted: boolean },
text: string,
)
| 847 | } |
| 848 | |
| 849 | function writeAnthropicTextDelta( |
| 850 | res: Response, |
| 851 | state: { blockIndex: number; textBlockStarted: boolean }, |
| 852 | text: string, |
| 853 | ): void { |
| 854 | if (!text) return; |
| 855 | |
| 856 | if (!state.textBlockStarted) { |
| 857 | writeSSE(res, 'content_block_start', { |
| 858 | type: 'content_block_start', |
| 859 | index: state.blockIndex, |
| 860 | content_block: { type: 'text', text: '' }, |
| 861 | }); |
| 862 | state.textBlockStarted = true; |
| 863 | } |
| 864 | |
| 865 | writeSSE(res, 'content_block_delta', { |
| 866 | type: 'content_block_delta', |
| 867 | index: state.blockIndex, |
| 868 | delta: { type: 'text_delta', text }, |
| 869 | }); |
| 870 | } |
| 871 | |
| 872 | function emitAnthropicThinkingBlock( |
| 873 | res: Response, |
no test coverage detected