mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-25 03:38:38 +00:00
feat(playground): enhance SSE debugging and add image paste support with i18n
- Add SSEViewer component for interactive SSE message inspection * Display SSE data stream with collapsible panels * Show parsed JSON with syntax highlighting * Display key information badges (content, tokens, finish reason) * Support copy individual or all SSE messages * Show error messages with detailed information - Support Ctrl+V to paste images in chat input * Enable image paste in CustomInputRender component * Auto-detect and add pasted images to image list * Show toast notifications for paste results - Add complete i18n support for 6 languages * Chinese (zh): Complete translations * English (en): Complete translations * Japanese (ja): Add 28 new translations * French (fr): Add 28 new translations * Russian (ru): Add 28 new translations * Vietnamese (vi): Add 32 new translations - Update .gitignore to exclude data directory
This commit is contained in:
@@ -82,7 +82,7 @@ const CustomRequestEditor = ({
|
||||
return true;
|
||||
} catch (error) {
|
||||
setIsValid(false);
|
||||
setErrorMessage(`JSON格式错误: ${error.message}`);
|
||||
setErrorMessage(`${t('JSON格式错误')}: ${error.message}`);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -123,14 +123,14 @@ const CustomRequestEditor = ({
|
||||
<div className='flex items-center gap-2'>
|
||||
<Code size={16} className='text-gray-500' />
|
||||
<Typography.Text strong className='text-sm'>
|
||||
自定义请求体模式
|
||||
{t('自定义请求体模式')}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<Switch
|
||||
checked={customRequestMode}
|
||||
onChange={handleModeToggle}
|
||||
checkedText='开'
|
||||
uncheckedText='关'
|
||||
checkedText={t('开')}
|
||||
uncheckedText={t('关')}
|
||||
size='small'
|
||||
/>
|
||||
</div>
|
||||
@@ -140,7 +140,7 @@ const CustomRequestEditor = ({
|
||||
{/* 提示信息 */}
|
||||
<Banner
|
||||
type='warning'
|
||||
description='启用此模式后,将使用您自定义的请求体发送API请求,模型配置面板的参数设置将被忽略。'
|
||||
description={t('启用此模式后,将使用您自定义的请求体发送API请求,模型配置面板的参数设置将被忽略。')}
|
||||
icon={<AlertTriangle size={16} />}
|
||||
className='!rounded-lg'
|
||||
closeIcon={null}
|
||||
@@ -150,21 +150,21 @@ const CustomRequestEditor = ({
|
||||
<div>
|
||||
<div className='flex items-center justify-between mb-2'>
|
||||
<Typography.Text strong className='text-sm'>
|
||||
请求体 JSON
|
||||
{t('请求体 JSON')}
|
||||
</Typography.Text>
|
||||
<div className='flex items-center gap-2'>
|
||||
{isValid ? (
|
||||
<div className='flex items-center gap-1 text-green-600'>
|
||||
<Check size={14} />
|
||||
<Typography.Text className='text-xs'>
|
||||
格式正确
|
||||
{t('格式正确')}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
) : (
|
||||
<div className='flex items-center gap-1 text-red-600'>
|
||||
<X size={14} />
|
||||
<Typography.Text className='text-xs'>
|
||||
格式错误
|
||||
{t('格式错误')}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
)}
|
||||
@@ -177,7 +177,7 @@ const CustomRequestEditor = ({
|
||||
disabled={!isValid}
|
||||
className='!rounded-lg'
|
||||
>
|
||||
格式化
|
||||
{t('格式化')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -201,7 +201,7 @@ const CustomRequestEditor = ({
|
||||
)}
|
||||
|
||||
<Typography.Text className='text-xs text-gray-500 mt-2 block'>
|
||||
请输入有效的JSON格式的请求体。您可以参考预览面板中的默认请求体格式。
|
||||
{t('请输入有效的JSON格式的请求体。您可以参考预览面板中的默认请求体格式。')}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user