Repository navigation
Commit d1a3c41
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 d1a3c41
27 files changed
Lines changed: 665 additions & 828 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 | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
This file was deleted.
This file was deleted.
0 commit comments