调整后台文字模型请求发送图片或者视频的方式base64,而不是现在的链接形式,增加后台配置

This commit is contained in:
2026-07-16 13:36:37 +08:00
parent 38040dfb0d
commit 4d872036b2
10 changed files with 198 additions and 60 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -28,7 +28,7 @@
}
})();
</script>
<script type="module" crossorigin src="/assets/index-Dn3Ncoha.js"></script>
<script type="module" crossorigin src="/assets/index-lC1vODuG.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css">
</head>
<body>
+38 -1
View File
@@ -3,7 +3,7 @@ import {
Button, Card, Form, Input, InputNumber, message, Select, Space, Switch, Typography, Upload,
} from 'antd';
import {
SettingOutlined, SaveOutlined, UploadOutlined, FilePdfOutlined, EyeOutlined, DatabaseOutlined, VideoCameraOutlined,
SettingOutlined, SaveOutlined, UploadOutlined, FilePdfOutlined, EyeOutlined, DatabaseOutlined, VideoCameraOutlined, RobotOutlined,
} from '@ant-design/icons';
import {
getGlobalResourceCapacity,
@@ -148,6 +148,17 @@ const AdminSettings: React.FC = () => {
message.success('已移除登录背景视频');
};
const handleToggleBase64 = async (checked: boolean) => {
const existing = configs.find(c => c.key === 'llm_media_as_base64');
if (existing) {
await updateSystemConfig(existing.id, checked ? 'true' : 'false');
setConfigs(prev => prev.map(c => c.key === 'llm_media_as_base64' ? { ...c, value: checked ? 'true' : 'false' } : c));
message.success(`${checked ? '开启' : '关闭'}文字模型媒体 base64 编码`);
} else {
message.warning('系统配置项异常,请刷新页面重试');
}
};
const groupedConfigs: Record<string, SystemConfig[]> = {
'站点信息': configs.filter(c => c.key.startsWith('site_')),
'协议配置': configs.filter(c => c.key === 'user_agreement_privacy_url'),
@@ -385,6 +396,32 @@ const AdminSettings: React.FC = () => {
</div>
</div>
{/* 文字模型媒体编码 */}
<div style={{ marginBottom: 24 }}>
<Typography.Text strong style={{ fontSize: 14, display: 'block', marginBottom: 12, paddingBottom: 8, borderBottom: '1px solid #f0f0f5' }}>
</Typography.Text>
<div style={{ padding: 16, borderRadius: 10, border: '1px solid #f0f0f5', background: '#fafbfc' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<Space>
<RobotOutlined style={{ color: '#6366f1', fontSize: 18 }} />
<div>
<Typography.Text strong>/ base64 </Typography.Text>
<div style={{ color: '#64748b', fontSize: 12, marginTop: 2 }}>
base64 URL
</div>
</div>
</Space>
<Switch
checked={(configs.find(c => c.key === 'llm_media_as_base64') || {}).value === 'true'}
onChange={handleToggleBase64}
checkedChildren="base64"
unCheckedChildren="链接"
/>
</div>
</div>
</div>
{Object.entries(groupedConfigs).map(([group, items]) => (
<div key={group} style={{ marginBottom: 24 }}>
<Typography.Text strong style={{ fontSize: 14, display: 'block', marginBottom: 12, paddingBottom: 8, borderBottom: '1px solid #f0f0f5' }}>