You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 62f596c
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(api): share the abort-signal resolution guard, race, and normalization
Move the entry guard, the rejectOnAbort race, and the abort-normalizing
catch out of the four gateway createMessage bodies and into a single
resolveModelWithAbort helper in utils/abort-signal.ts. Each provider now
calls it in one line, so the cancellation semantics around model
resolution are implemented once and exercised through every provider's
spec.
Also compact the completePrompt request-options blocks (conditional
spreads instead of if-assigned mutable objects) and align the
streamResponsesMessage/streamAnthropicMessage pre-stream guards on the
shared isRequestAborted predicate.
// Stryker disable next-line StringLiteral: the raw rejectOnAbort rejection is re-stamped by the catch's createAbortError below (its name "AbortError" always matches isRequestAborted), so this provider-name literal is unobservable
// Stryker disable next-line StringLiteral: the raw rejectOnAbort rejection is re-stamped by the catch's createAbortError below (its name "AbortError" always matches isRequestAborted), so this provider-name literal is unobservable
// Stryker disable next-line StringLiteral: the raw rejectOnAbort rejection is re-stamped by the catch's createAbortError below (its name "AbortError" always matches isRequestAborted), so this provider-name literal is unobservable
79
-
resolved=awaitrejectOnAbort(this.fetchModel(),externalAbortSignal,"Vercel AI Gateway")
80
-
}else{
81
-
resolved=awaitthis.fetchModel()
82
-
}
83
-
}catch(error){
84
-
if(isRequestAborted(error,externalAbortSignal)){
85
-
throwcreateAbortError("Vercel AI Gateway")
86
-
}
87
-
throwerror
88
-
}
68
+
constresolved=awaitresolveModelWithAbort(()=>this.fetchModel(),externalAbortSignal,"Vercel AI Gateway")
// Stryker disable next-line StringLiteral: the raw rejectOnAbort rejection is re-stamped by the catch's createAbortError below (its name "AbortError" always matches isRequestAborted), so this provider-name literal is unobservable
0 commit comments