Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit ec83b19

Browse files
committed
fix(ChatCard): add error message for Cloudflare security check
Refactor error handling in ChatCard Correct handling of 'UNAUTHORIZED' and 'CLOUDFLARE' errors in ChatCard to provide more descriptive messages.
1 parent a2eccf5 commit ec83b19

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/components/ChatCard.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function ChatCard(props: ChatCardProps) {
167167
}
168168
if (msg.error) {
169169
switch (msg.error) {
170-
case 'UNAUTHORIZED' || 'CLOUDFLARE':
170+
case 'UNAUTHORIZED':
171171
updateAnswer(
172172
`**ACCESS DENIED**: Kindly log in at [https://chat.openai.com](https://chat.openai.com) first.
173173
Afterward, refresh this webpage or re-enter your inquiry.
@@ -178,6 +178,17 @@ function ChatCard(props: ChatCardProps) {
178178
'error',
179179
)
180180
break
181+
case 'CLOUDFLARE':
182+
updateAnswer(
183+
`**Security Check Required**: Please open [https://chat.openai.com](https://chat.openai.com) first.
184+
Afterward, refresh this webpage or re-enter your inquiry.
185+
You may also want to create an API key at
186+
[https://platform.openai.com/account/api-keys](https://platform.openai.com/account/api-keys)
187+
for enhanced functionality.`,
188+
false,
189+
'error',
190+
)
191+
break
181192
case 'RETRY':
182193
updateAnswer(
183194
'Please wait a moment and try again. (refreshing the page may help)',

0 commit comments

Comments
 (0)