(currentText: string, newToken: string)
| 28 | * of excessive whitespace during real-time text generation. |
| 29 | */ |
| 30 | export function normalizeStreamingToken(currentText: string, newToken: string): string { |
| 31 | if (!newToken || typeof newToken !== 'string') { |
| 32 | return currentText; |
| 33 | } |
| 34 | |
| 35 | let combined = currentText + newToken; |
| 36 | |
| 37 | combined = normalizeWhitespace(combined); |
| 38 | |
| 39 | return combined; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Check if text contains excessive whitespace that needs normalization |
no test coverage detected