Commit ec33b97
committed
fix(sdk): preserve stream backpressure when tapping chat chunks
Tap the response stream with a TransformStream instead of an async generator.
The generator forced ensureReadableStream down its eager-drain wrapper, which
enqueues without honoring desiredSize (dropping backpressure to the model
stream) and never propagates consumer cancel to the source. piping through a
TransformStream keeps the ReadableStream pass-through, so native backpressure
and stop/cancel propagation are retained. Also stamp an id on a recovered
partial that lacks one, matching the success path.1 parent 882364a commit ec33b97
1 file changed
Lines changed: 16 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7949 | 7949 | | |
7950 | 7950 | | |
7951 | 7951 | | |
| 7952 | + | |
| 7953 | + | |
| 7954 | + | |
7952 | 7955 | | |
7953 | 7956 | | |
7954 | 7957 | | |
| |||
8982 | 8985 | | |
8983 | 8986 | | |
8984 | 8987 | | |
8985 | | - | |
| 8988 | + | |
8986 | 8989 | | |
8987 | 8990 | | |
8988 | | - | |
| 8991 | + | |
8989 | 8992 | | |
8990 | | - | |
8991 | | - | |
8992 | | - | |
8993 | | - | |
8994 | | - | |
8995 | | - | |
8996 | | - | |
8997 | | - | |
8998 | | - | |
8999 | | - | |
9000 | | - | |
9001 | | - | |
| 8993 | + | |
| 8994 | + | |
| 8995 | + | |
| 8996 | + | |
| 8997 | + | |
| 8998 | + | |
| 8999 | + | |
| 9000 | + | |
| 9001 | + | |
| 9002 | + | |
9002 | 9003 | | |
9003 | 9004 | | |
9004 | 9005 | | |
9005 | 9006 | | |
9006 | | - | |
| 9007 | + | |
9007 | 9008 | | |
9008 | 9009 | | |
9009 | 9010 | | |
| |||
0 commit comments