feat: add image preview functionality and update model name instructions in EditChannel

This commit is contained in:
CaIon
2025-04-27 17:20:49 +08:00
parent bb9f5a4a6d
commit 4217358de7
3 changed files with 32 additions and 3 deletions

View File

@@ -24,9 +24,10 @@ import {
TextArea,
Checkbox,
Banner,
Modal,
Modal, ImagePreview
} from '@douyinfe/semi-ui';
import { getChannelModels, loadChannelModels } from '../../components/utils.js';
import { IconHelpCircle } from '@douyinfe/semi-icons';
const MODEL_MAPPING_EXAMPLE = {
'gpt-3.5-turbo': 'gpt-3.5-turbo-0125',
@@ -96,6 +97,8 @@ const EditChannel = (props) => {
const [basicModels, setBasicModels] = useState([]);
const [fullModels, setFullModels] = useState([]);
const [customModel, setCustomModel] = useState('');
const [modalImageUrl, setModalImageUrl] = useState('');
const [isModalOpenurl, setIsModalOpenurl] = useState(false);
const handleInputChange = (name, value) => {
if (name === 'base_url' && value.endsWith('/v1')) {
Modal.confirm({
@@ -472,7 +475,28 @@ const EditChannel = (props) => {
<div style={{ marginTop: 10 }}>
<Banner
type={'warning'}
description={t('注意系统请求的时模型名称中的点会被剔除例如gpt-4.5-preview会请求为gpt-45-preview所以部署的模型名称需要去掉点')}
description={
<>
{t('注意系统请求的时模型名称中的点会被剔除例如gpt-4.1会请求为gpt-41所以在Azure部署的时候部署模型名称需要手动改为gpt-41')}
<br />
<Typography.Text
style={{
color: 'rgba(var(--semi-blue-5), 1)',
userSelect: 'none',
cursor: 'pointer',
}}
onClick={() => {
setModalImageUrl(
'/azure_model_name.png',
);
setIsModalOpenurl(true)
}}
>
{t('查看示例')}
</Typography.Text>
</>
}
></Banner>
</div>
<div style={{ marginTop: 10 }}>
@@ -1109,6 +1133,11 @@ const EditChannel = (props) => {
{t('填入模板')}
</Typography.Text>
</Spin>
<ImagePreview
src={modalImageUrl}
visible={isModalOpenurl}
onVisibleChange={(visible) => setIsModalOpenurl(visible)}
/>
</SideSheet>
</>
);