mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
💄 style: Use new Alert ui
This commit is contained in:
@@ -3,7 +3,6 @@ import { memo } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import OpenAPIKey from './OpenAPIKey';
|
||||
import { useStyles } from './style';
|
||||
|
||||
interface OpenAIError {
|
||||
code: 'invalid_api_key' | string;
|
||||
@@ -17,8 +16,6 @@ interface OpenAIErrorResponse {
|
||||
}
|
||||
|
||||
const OpenAiBizError: RenderErrorMessage = memo(({ error, id, ...props }) => {
|
||||
const { styles } = useStyles();
|
||||
|
||||
const errorBody: OpenAIErrorResponse = (error as any)?.body;
|
||||
|
||||
const errorCode = errorBody.error?.code;
|
||||
@@ -26,8 +23,10 @@ const OpenAiBizError: RenderErrorMessage = memo(({ error, id, ...props }) => {
|
||||
if (errorCode === 'invalid_api_key') return <OpenAPIKey error={error} id={id} {...props} />;
|
||||
|
||||
return (
|
||||
<Flexbox className={styles.container} style={{ maxWidth: 600 }}>
|
||||
<Highlighter language={'json'}>{JSON.stringify(errorBody, null, 2)}</Highlighter>
|
||||
<Flexbox style={{ maxWidth: 600 }}>
|
||||
<Highlighter copyButtonSize={'small'} language={'json'} type={'pure'}>
|
||||
{JSON.stringify(errorBody, null, 2)}
|
||||
</Highlighter>
|
||||
</Flexbox>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2,8 +2,6 @@ import { Highlighter, RenderErrorMessage } from '@lobehub/ui';
|
||||
import { memo } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { useStyles } from '../style';
|
||||
|
||||
interface OpenAIError {
|
||||
code: 'invalid_api_key' | string;
|
||||
message: string;
|
||||
@@ -16,12 +14,13 @@ interface OpenAIErrorResponse {
|
||||
}
|
||||
|
||||
const PluginError: RenderErrorMessage = memo(({ error, id }) => {
|
||||
const { styles } = useStyles();
|
||||
const errorBody: OpenAIErrorResponse = (error as any)?.body;
|
||||
|
||||
return (
|
||||
<Flexbox className={styles.container} id={id} style={{ maxWidth: 600 }}>
|
||||
<Highlighter language={'json'}>{JSON.stringify(errorBody, null, 2)}</Highlighter>
|
||||
<Flexbox id={id} style={{ maxWidth: 600 }}>
|
||||
<Highlighter copyButtonSize={'small'} language={'json'} type={'pure'}>
|
||||
{JSON.stringify(errorBody, null, 2)}
|
||||
</Highlighter>
|
||||
</Flexbox>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -5,6 +5,11 @@ import { Center, Flexbox } from 'react-layout-kit';
|
||||
|
||||
export const useStyles = createStyles(({ css, token }) => ({
|
||||
container: css`
|
||||
margin-top: -4px;
|
||||
margin-bottom: 4px;
|
||||
|
||||
color: ${token.colorText};
|
||||
|
||||
background: ${token.colorBgContainer};
|
||||
border: 1px solid ${token.colorSplit};
|
||||
border-radius: 8px;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Alert, Button, Divider, Input } from 'antd';
|
||||
import { Alert } from '@lobehub/ui';
|
||||
import { Button, Divider, Input } from 'antd';
|
||||
import { useTheme } from 'antd-style';
|
||||
import isEqual from 'fast-deep-equal';
|
||||
import { kebabCase } from 'lodash-es';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Alert, Button } from 'antd';
|
||||
import { Alert } from '@lobehub/ui';
|
||||
import { Button } from 'antd';
|
||||
import Link from 'next/link';
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CheckCircleFilled } from '@ant-design/icons';
|
||||
import { Highlighter } from '@lobehub/ui';
|
||||
import { Alert, Button } from 'antd';
|
||||
import { Alert, Highlighter } from '@lobehub/ui';
|
||||
import { Button } from 'antd';
|
||||
import { useTheme } from 'antd-style';
|
||||
import { memo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -72,10 +72,19 @@ const Checker = memo<CheckerProps>(({ checkModel }) => {
|
||||
|
||||
{error && (
|
||||
<Flexbox gap={8}>
|
||||
<Alert banner message={error.message} showIcon type={'error'}></Alert>
|
||||
<Flexbox style={{ maxWidth: 600 }}>
|
||||
<Highlighter language={'json'}>{JSON.stringify(error.body, null, 2)}</Highlighter>
|
||||
</Flexbox>
|
||||
<Alert
|
||||
banner
|
||||
extra={
|
||||
<Flexbox style={{ maxWidth: 600 }}>
|
||||
<Highlighter copyButtonSize={'small'} language={'json'} type={'pure'}>
|
||||
{JSON.stringify(error.body, null, 2)}
|
||||
</Highlighter>
|
||||
</Flexbox>
|
||||
}
|
||||
message={error.message}
|
||||
showIcon
|
||||
type={'error'}
|
||||
/>
|
||||
</Flexbox>
|
||||
)}
|
||||
</Flexbox>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Form, Input, Modal } from '@lobehub/ui';
|
||||
import { Alert } from 'antd';
|
||||
import { Alert, Form, Input, Modal } from '@lobehub/ui';
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Modal } from '@lobehub/ui';
|
||||
import { Alert, App, Button, Form, Popconfirm } from 'antd';
|
||||
import { Alert, Modal } from '@lobehub/ui';
|
||||
import { App, Button, Form, Popconfirm } from 'antd';
|
||||
import { useResponsive } from 'antd-style';
|
||||
import { memo, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
Reference in New Issue
Block a user