Skip to content

Commit

Permalink
fix: add error if no money
Browse files Browse the repository at this point in the history
  • Loading branch information
wajeht committed Jan 1, 2025
1 parent 4ec4a5b commit 5d110fe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ export const openAI: AIService = {
.map((choice) => choice.message.content);
return getRandomElement(messages);
} catch (error: any) {

Check warning on line 98 in src/ai.ts

View workflow job for this annotation

GitHub Actions / ESLint (22.x)

Unexpected any. Specify a different type
if (error.code === 'insufficient_quota') {
throw new UnauthorizedError(
'You exceeded your current quota, please check your plan and billing details',
);
}

if (error.code === 'context_length_exceeded') {
throw new ValidationError('The provided input exceeds the maximum allowed token length.');
}
Expand Down

0 comments on commit 5d110fe

Please sign in to comment.