(text: string)
| 825 | let hybridReasoningSent = false; |
| 826 | |
| 827 | const pushToStreamer = (text: string): void => { |
| 828 | if (!text || toolMarkerDetected) return; |
| 829 | pendingText += text; |
| 830 | const idx = pendingText.indexOf(TOOL_MARKER); |
| 831 | if (idx >= 0) { |
| 832 | const before = pendingText.substring(0, idx); |
| 833 | if (before) { |
| 834 | const d = hybridStreamer.push(before); |
| 835 | if (d) { |
| 836 | if (thinkingEnabled && hybridThinkingContent && !hybridReasoningSent) { |
| 837 | writeOpenAIReasoningDelta(res, id, created, model, hybridThinkingContent); |
| 838 | hybridReasoningSent = true; |
| 839 | } |
| 840 | writeOpenAITextDelta(res, id, created, model, d); |
| 841 | hybridTextSent = true; |
| 842 | } |
| 843 | } |
| 844 | toolMarkerDetected = true; |
| 845 | pendingText = ''; |
| 846 | return; |
| 847 | } |
| 848 | const safeEnd = pendingText.length - MARKER_LOOKBACK; |
| 849 | if (safeEnd > 0) { |
| 850 | const safe = pendingText.substring(0, safeEnd); |
| 851 | pendingText = pendingText.substring(safeEnd); |
| 852 | const d = hybridStreamer.push(safe); |
| 853 | if (d) { |
| 854 | if (thinkingEnabled && hybridThinkingContent && !hybridReasoningSent) { |
| 855 | writeOpenAIReasoningDelta(res, id, created, model, hybridThinkingContent); |
| 856 | hybridReasoningSent = true; |
| 857 | } |
| 858 | writeOpenAITextDelta(res, id, created, model, d); |
| 859 | hybridTextSent = true; |
| 860 | } |
| 861 | } |
| 862 | }; |
| 863 | |
| 864 | const processHybridDelta = (delta: string): void => { |
| 865 | if (!hybridLeadingResolved) { |
no test coverage detected