Repository navigation
Commit 50500de
committed
fix(api): pass abortSignal to streamText() for OpenAI Compatible provider (Zoo-Code-Org#404)
When user clicks stop during streaming, the HTTP request to the provider
continues running because Vercel AI SDK's streamText() doesn't receive an
abort signal. This wastes API tokens/compute on the provider side.
Changes:
- Add abortSignal?: AbortSignal to ApiHandlerCreateMessageMetadata interface
- Pass Task.ts's AbortController.signal through metadata to createMessage()
- Use signal in openai-compatible.ts streamText() options
This fix affects all OpenAICompatibleHandler subclasses (LiteLLM, OpenRouter,
Vercel AI Gateway, etc.) that use the Vercel AI SDK.
Fixes Zoo-Code-Org#4041 parent f1f7cb4 commit 50500de
27 files changed
Lines changed: 664 additions & 829 deletions
File tree
- locales
- zh-CN
- zh-TW
- src
- api
- providers
- __tests__
- core/task
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | 87 | | |
90 | | - | |
| 88 | + | |
91 | 89 | | |
92 | 90 | | |
93 | 91 | | |
| |||
This file was deleted.
This file was deleted.
0 commit comments