(params: {
isChatGptOAuth: boolean
skipChatGptOAuth?: boolean
hasYieldedContent: boolean
error: unknown
})
| 261 | | 'ignore' |
| 262 | |
| 263 | export function classifyChatGptOAuthStreamError(params: { |
| 264 | isChatGptOAuth: boolean |
| 265 | skipChatGptOAuth?: boolean |
| 266 | hasYieldedContent: boolean |
| 267 | error: unknown |
| 268 | }): ChatGptOAuthStreamErrorPolicy { |
| 269 | const { isChatGptOAuth, skipChatGptOAuth, hasYieldedContent, error } = params |
| 270 | |
| 271 | if (!isChatGptOAuth || skipChatGptOAuth || hasYieldedContent) { |
| 272 | return 'ignore' |
| 273 | } |
| 274 | |
| 275 | if (isOAuthRateLimitError(error)) { |
| 276 | return 'fallback-rate-limit' |
| 277 | } |
| 278 | |
| 279 | if (isOAuthAuthError(error)) { |
| 280 | return 'fail-auth-reconnect' |
| 281 | } |
| 282 | |
| 283 | return 'fail-fast' |
| 284 | } |
| 285 | |
| 286 | export async function* promptAiSdkStream( |
| 287 | params: ParamsOf<PromptAiSdkStreamFn> & { |
no test coverage detected