Skip to content

Commit 4d7c419

Browse files
authored
fix(autocorrelation): Handle quota exceeded error in the UI (#1113)
1 parent e375792 commit 4d7c419

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/views/Generator/AutoCorrelation/ErrorMessage.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { Button, Flex, Text } from '@radix-ui/themes'
2-
import { ExternalLink, KeyIcon, RefreshCw } from 'lucide-react'
2+
import {
3+
ExternalLink as ExternalLinkIcon,
4+
KeyIcon,
5+
RefreshCw,
6+
} from 'lucide-react'
37

48
import grotCrashed from '@/assets/grot-crashed.svg'
9+
import { ExternalLink } from '@/components/ExternalLink'
510
import { useSettingsChanged } from '@/hooks/useSettings'
611
import { useFeaturesStore } from '@/store/features'
712
import { useStudioUIStore } from '@/store/ui'
@@ -49,7 +54,7 @@ function OpenAiError({ error, onRetry }: AutoCorrelationErrorProps) {
4954

5055
const reportIssueButton = (
5156
<Button onClick={() => window.studio.ui.reportIssue()} variant="outline">
52-
<ExternalLink />
57+
<ExternalLinkIcon />
5358
Report issue
5459
</Button>
5560
)
@@ -65,6 +70,25 @@ function OpenAiError({ error, onRetry }: AutoCorrelationErrorProps) {
6570
)
6671
}
6772

73+
if (errorMessage.includes('insufficient_quota')) {
74+
return (
75+
<MessageContent
76+
title="Quota exceeded"
77+
message={
78+
<>
79+
You have exceeded your OpenAI API quota. Check your{' '}
80+
<ExternalLink href="https://platform.openai.com/account/billing">
81+
plan and billing details
82+
</ExternalLink>{' '}
83+
on the OpenAI platform.
84+
</>
85+
}
86+
>
87+
{openSettingsButton}
88+
</MessageContent>
89+
)
90+
}
91+
6892
if (errorMessage.includes('context window')) {
6993
return (
7094
<MessageContent

0 commit comments

Comments
 (0)