MCPcopy Create free account
hub / github.com/PromtEngineer/localGPT / normalizeStreamingToken

Function normalizeStreamingToken

src/utils/textNormalization.ts:30–40  ·  view source on GitHub ↗
(currentText: string, newToken: string)

Source from the content-addressed store, hash-verified

28 * of excessive whitespace during real-time text generation.
29 */
30export 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

Callers 1

sendMessageFunction · 0.90

Calls 1

normalizeWhitespaceFunction · 0.85

Tested by

no test coverage detected