fix: handle error message when apikey is not setup (#3149)
This commit is contained in:
parent
40dd0caaac
commit
eac415aeca
@ -83,6 +83,8 @@ export enum MessageStatus {
|
|||||||
export enum ErrorCode {
|
export enum ErrorCode {
|
||||||
InvalidApiKey = 'invalid_api_key',
|
InvalidApiKey = 'invalid_api_key',
|
||||||
|
|
||||||
|
AuthenticationError = 'authentication_error',
|
||||||
|
|
||||||
InsufficientQuota = 'insufficient_quota',
|
InsufficientQuota = 'insufficient_quota',
|
||||||
|
|
||||||
InvalidRequestError = 'invalid_request_error',
|
InvalidRequestError = 'invalid_request_error',
|
||||||
|
|||||||
@ -41,12 +41,13 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
|
|||||||
case ErrorCode.Unknown:
|
case ErrorCode.Unknown:
|
||||||
return 'Apologies, something’s amiss!'
|
return 'Apologies, something’s amiss!'
|
||||||
case ErrorCode.InvalidApiKey:
|
case ErrorCode.InvalidApiKey:
|
||||||
|
case ErrorCode.AuthenticationError:
|
||||||
case ErrorCode.InvalidRequestError:
|
case ErrorCode.InvalidRequestError:
|
||||||
return (
|
return (
|
||||||
<span data-testid="invalid-API-key-error">
|
<span data-testid="invalid-API-key-error">
|
||||||
Invalid API key. Please check your API key from{' '}
|
Invalid API key. Please check your API key from{' '}
|
||||||
<button
|
<button
|
||||||
className="font-medium text-[hsla(var(--app-link))]"
|
className="font-medium text-[hsla(var(--app-link))] underline"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setMainState(MainViewState.Settings)
|
setMainState(MainViewState.Settings)
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
|
|||||||
<p>
|
<p>
|
||||||
Jan’s in beta. Access
|
Jan’s in beta. Access
|
||||||
<span
|
<span
|
||||||
className="cursor-pointer text-[hsla(var(--app-link))]"
|
className="cursor-pointer text-[hsla(var(--app-link))] underline"
|
||||||
onClick={() => setModalTroubleShooting(true)}
|
onClick={() => setModalTroubleShooting(true)}
|
||||||
>
|
>
|
||||||
troubleshooting assistance
|
troubleshooting assistance
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user