Skip to content

Commit e9016ef

Browse files
committed
feat: copilot rate limit error adaptation
1 parent 70a6bb1 commit e9016ef

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/services/copilot/create-responses.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ export interface ResponseErrorEvent {
357357
param: string | null
358358
sequence_number: number
359359
type: "error"
360+
error?: {
361+
code: string | null
362+
message: string
363+
}
360364
}
361365

362366
export interface ResponseFunctionCallArgumentsDeltaEvent {
@@ -655,10 +659,20 @@ const createResponsesWebSocketStreamChunk = (
655659
copilot_quota_snapshots?: Record<string, CopilotQuotaSnapshot>
656660
id?: unknown
657661
type?: unknown
662+
error?: {
663+
code: string | null
664+
message: string
665+
}
666+
code?: string | null
667+
message?: string
658668
}
659669
if (parsed.type === "response.completed") {
660670
logCopilotQuotaSnapshots(parsed.copilot_quota_snapshots)
661671
}
672+
if (parsed.type === "error" && parsed.error) {
673+
parsed.code = parsed.error.code
674+
parsed.message = parsed.error.message
675+
}
662676
return {
663677
data: JSON.stringify(parsed),
664678
event: typeof parsed.type === "string" ? parsed.type : undefined,

0 commit comments

Comments
 (0)