-
Notifications
You must be signed in to change notification settings - Fork 267
feat(api): abort signal support for openai, openai-compatible base, zai, kimi-code (round 2) #1311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
easonLiangWorldedtech
wants to merge
13
commits into
Zoo-Code-Org:main
Choose a base branch
from
easonLiangWorldedtech:feat/abort-r2-openai-family
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e61feb1
feat(api): add throwIfAborted helper and completePrompt options regre…
easonliang28 e65cc08
feat(api): abort signal support for openai, openai-compatible base, z…
easonLiangWorldedtech 4a31692
test(providers): export APIUserAbortError from openai mock in firewor…
easonLiangWorldedtech 35c95ea
fix(api): normalize abort errors raised during stream iteration
easonLiangWorldedtech 217f120
test(providers): cover the base_resp stream error path through the it…
easonLiangWorldedtech af320da
test(providers): cover remaining branch partials in base provider and…
easonLiangWorldedtech a0117fb
feat(api): add shared isRequestAborted and createAbortError helpers t…
easonLiangWorldedtech 36f0b42
Merge branch 'feat/abort-r1-foundation' into feat/abort-r2-openai-family
easonLiangWorldedtech 8632025
Merge remote-tracking branch 'upstream/main' into feat/abort-r2-opena…
easonliang28 20b1228
test(zai): align GLM-5.3-Flash expectations with abort-signal request…
easonliang28 8ce2489
refactor(api): dedupe handleOpenAIRequestError and strengthen abort-s…
easonliang28 cb77e0c
fix(api): reject pre-aborted Kimi requests and forward per-request ti…
easonliang28 c9311dc
fix(api): forward per-request timeoutMs and harden abort specs
easonliang28 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/api/providers/__tests__/complete-prompt-options.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { describe, it, expect } from "vitest" | ||
|
|
||
| import type { CompletePromptOptions } from "../../index" | ||
|
|
||
| describe("CompletePromptOptions", () => { | ||
| it("should allow abortSignal property", () => { | ||
| const controller = new AbortController() | ||
| const options: CompletePromptOptions = { abortSignal: controller.signal } | ||
| expect(options.abortSignal).toBe(controller.signal) | ||
| }) | ||
|
|
||
| it("should allow timeoutMs property", () => { | ||
| const options: CompletePromptOptions = { timeoutMs: 5000 } | ||
| expect(options.timeoutMs).toBe(5000) | ||
| }) | ||
|
|
||
| it("should allow both abortSignal and timeoutMs together", () => { | ||
| const controller = new AbortController() | ||
| const options: CompletePromptOptions = { abortSignal: controller.signal, timeoutMs: 10000 } | ||
| expect(options.abortSignal).toBe(controller.signal) | ||
| expect(options.timeoutMs).toBe(10000) | ||
| }) | ||
|
|
||
| it("should allow empty options object", () => { | ||
| const options: CompletePromptOptions = {} | ||
| expect(options.abortSignal).toBeUndefined() | ||
| expect(options.timeoutMs).toBeUndefined() | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.