Download client/src/features/chat/completionStreamAssert.ts from dqy08/InfoLens: direct link, hf CLI and curl.
- Browser
- Download file 484 Bytes
-
https://huggingface.co/spaces/dqy08/InfoLens/resolve/main/client/src/features/chat/completionStreamAssert.ts
- Command line
-
hf download hf://spaces/dqy08/InfoLens/client/src/features/chat/completionStreamAssert.ts
-
curl -L -o completionStreamAssert.ts https://huggingface.co/spaces/dqy08/InfoLens/resolve/main/client/src/features/chat/completionStreamAssert.ts
484 Bytes
| /** Stop 后服务端仍可能省略尾部若干 delta;最终以 result 为准,仅拒绝明显不一致。 */ | |
| export function assertStreamMatchesFinal(streamedText: string, finalText: string): void { | |
| if (finalText !== streamedText && !finalText.startsWith(streamedText)) { | |
| throw new Error( | |
| 'Streaming deltas do not match final text (retry or report): ' + | |
| `delta_len=${streamedText.length}, final_len=${finalText.length}` | |
| ); | |
| } | |
| } | |