|
@@ -6,7 +6,7 @@ import {
|
|
|
isMobile,
|
|
isMobile,
|
|
|
showError,
|
|
showError,
|
|
|
showInfo,
|
|
showInfo,
|
|
|
- showSuccess,
|
|
|
|
|
|
|
+ showSuccess, showWarning,
|
|
|
verifyJSON
|
|
verifyJSON
|
|
|
} from '../../helpers';
|
|
} from '../../helpers';
|
|
|
import { CHANNEL_OPTIONS } from '../../constants';
|
|
import { CHANNEL_OPTIONS } from '../../constants';
|
|
@@ -22,11 +22,9 @@ import {
|
|
|
Select,
|
|
Select,
|
|
|
TextArea,
|
|
TextArea,
|
|
|
Checkbox,
|
|
Checkbox,
|
|
|
- Banner
|
|
|
|
|
|
|
+ Banner, Modal
|
|
|
} from '@douyinfe/semi-ui';
|
|
} from '@douyinfe/semi-ui';
|
|
|
-import { Divider } from 'semantic-ui-react';
|
|
|
|
|
import { getChannelModels, loadChannelModels } from '../../components/utils.js';
|
|
import { getChannelModels, loadChannelModels } from '../../components/utils.js';
|
|
|
-import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
const MODEL_MAPPING_EXAMPLE = {
|
|
const MODEL_MAPPING_EXAMPLE = {
|
|
|
'gpt-3.5-turbo': 'gpt-3.5-turbo-0125'
|
|
'gpt-3.5-turbo': 'gpt-3.5-turbo-0125'
|
|
@@ -41,8 +39,6 @@ const REGION_EXAMPLE = {
|
|
|
'claude-3-5-sonnet-20240620': 'europe-west1'
|
|
'claude-3-5-sonnet-20240620': 'europe-west1'
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const fetchButtonTips = '1. 新建渠道时,请求通过当前浏览器发出;2. 编辑已有渠道,请求通过后端服务器发出';
|
|
|
|
|
-
|
|
|
|
|
function type2secretPrompt(type) {
|
|
function type2secretPrompt(type) {
|
|
|
// inputs.type === 15 ? '按照如下格式输入:APIKey|SecretKey' : (inputs.type === 18 ? '按照如下格式输入:APPID|APISecret|APIKey' : '请输入渠道对应的鉴权密钥')
|
|
// inputs.type === 15 ? '按照如下格式输入:APIKey|SecretKey' : (inputs.type === 18 ? '按照如下格式输入:APPID|APISecret|APIKey' : '请输入渠道对应的鉴权密钥')
|
|
|
switch (type) {
|
|
switch (type) {
|
|
@@ -99,6 +95,16 @@ const EditChannel = (props) => {
|
|
|
const [fullModels, setFullModels] = useState([]);
|
|
const [fullModels, setFullModels] = useState([]);
|
|
|
const [customModel, setCustomModel] = useState('');
|
|
const [customModel, setCustomModel] = useState('');
|
|
|
const handleInputChange = (name, value) => {
|
|
const handleInputChange = (name, value) => {
|
|
|
|
|
+ if (name === 'base_url' && value.endsWith('/v1')) {
|
|
|
|
|
+ Modal.confirm({
|
|
|
|
|
+ title: '警告',
|
|
|
|
|
+ content: '不需要在末尾加/v1,New API会自动处理,添加后可能导致请求失败,是否继续?',
|
|
|
|
|
+ onOk: () => {
|
|
|
|
|
+ setInputs((inputs) => ({ ...inputs, [name]: value }));
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
setInputs((inputs) => ({ ...inputs, [name]: value }));
|
|
setInputs((inputs) => ({ ...inputs, [name]: value }));
|
|
|
if (name === 'type') {
|
|
if (name === 'type') {
|
|
|
let localModels = [];
|
|
let localModels = [];
|
|
@@ -524,6 +530,16 @@ const EditChannel = (props) => {
|
|
|
/>
|
|
/>
|
|
|
</>
|
|
</>
|
|
|
)}
|
|
)}
|
|
|
|
|
+ {inputs.type === 37 && (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <div style={{ marginTop: 10 }}>
|
|
|
|
|
+ <Banner
|
|
|
|
|
+ type={'warning'}
|
|
|
|
|
+ description={t('Dify渠道只适配chatflow和agent,并且agent不支持图片!')}
|
|
|
|
|
+ ></Banner>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </>
|
|
|
|
|
+ )}
|
|
|
<div style={{ marginTop: 10 }}>
|
|
<div style={{ marginTop: 10 }}>
|
|
|
<Typography.Text strong>{t('名称')}:</Typography.Text>
|
|
<Typography.Text strong>{t('名称')}:</Typography.Text>
|
|
|
</div>
|
|
</div>
|