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

Commit 8d4dc32

Browse files
committed
fix: update message for UNAUTHORIZED error
1 parent a46f261 commit 8d4dc32

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

src/components/ChatCard.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Key, memo, SetStateAction, useCallback, useEffect, useRef, useState } f
66
import Browser from 'webextension-polyfill'
77
import { defaultConfig, getUserConfig } from '../configs/userConfig'
88
import { useClampWindowSize } from '../hooks/useClampWindowSize'
9-
import { ConversationRecord, initSession, isSafari, Session } from '../utils'
9+
import { ConversationRecord, initSession, Session } from '../utils'
1010
import ChatInputBox from './ChatInputBox'
1111
import ChatItem from './ChatItem'
1212

@@ -150,22 +150,13 @@ function ChatCard(props: ChatCardProps) {
150150
}
151151
if (msg.error) {
152152
switch (msg.error) {
153-
case 'UNAUTHORIZED':
153+
case 'UNAUTHORIZED' || 'CLOUDFLARE':
154154
UpdateAnswer(
155-
`UNAUTHORIZED\nPlease login at https://chat.openai.com first${
156-
isSafari() ? 'Then open https://chat.openai.com/api/auth/session' : ''
157-
}\nAnd refresh this page or type you question again.` +
158-
`\n\nConsider creating an api key at https://platform.openai.com/account/api-keys`,
159-
false,
160-
'error',
161-
)
162-
break
163-
case 'CLOUDFLARE':
164-
UpdateAnswer(
165-
`OpenAI Security Check Required\nPlease open ${
166-
isSafari() ? 'https://chat.openai.com/api/auth/session' : 'https://chat.openai.com'
167-
}\nAnd refresh this page or type you question again.` +
168-
`\n\nConsider creating an api key at https://platform.openai.com/account/api-keys`,
155+
`**ACCESS DENIED**: Kindly log in at [https://chat.openai.com](https://chat.openai.com) first.
156+
Afterward, refresh this webpage or re-enter your inquiry.
157+
You may also want to create an API key at
158+
[https://platform.openai.com/account/api-keys](https://platform.openai.com/account/api-keys)
159+
for enhanced functionality.`,
169160
false,
170161
'error',
171162
)

0 commit comments

Comments
 (0)