mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-08 17:53:41 +08:00
Merge commit '3d149fedf45472eff92910324974c762fc37dad6'
This commit is contained in:
@@ -33,7 +33,7 @@ function renderType(type) {
|
||||
}
|
||||
type2label[0] = { value: 0, text: '未知类型', color: 'grey' };
|
||||
}
|
||||
return <Label basic color={type2label[type]?.color}>{type2label[type]?.text}</Label>;
|
||||
return <Label basic color={type2label[type]?.color}>{type2label[type] ? type2label[type].text : type}</Label>;
|
||||
}
|
||||
|
||||
function renderBalance(type, balance) {
|
||||
|
||||
@@ -12,6 +12,7 @@ const COPY_OPTIONS = [
|
||||
];
|
||||
|
||||
const OPEN_LINK_OPTIONS = [
|
||||
{ key: 'next', text: 'ChatGPT Next Web', value: 'next' },
|
||||
{ key: 'ama', text: 'BotGem', value: 'ama' },
|
||||
{ key: 'opencat', text: 'OpenCat', value: 'opencat' },
|
||||
];
|
||||
|
||||
@@ -19,6 +19,7 @@ export const CHANNEL_OPTIONS = [
|
||||
{ key: 30, text: 'Ollama', value: 30, color: 'black' },
|
||||
{ key: 31, text: '零一万物', value: 31, color: 'green' },
|
||||
{ key: 32, text: '阶跃星辰', value: 32, color: 'blue' },
|
||||
{ key: 34, text: 'Coze', value: 34, color: 'blue' },
|
||||
{ key: 8, text: '自定义渠道', value: 8, color: 'pink' },
|
||||
{ key: 22, text: '知识库:FastGPT', value: 22, color: 'blue' },
|
||||
{ key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple' },
|
||||
|
||||
@@ -57,7 +57,8 @@ const EditChannel = () => {
|
||||
const [config, setConfig] = useState({
|
||||
region: '',
|
||||
sk: '',
|
||||
ak: ''
|
||||
ak: '',
|
||||
user_id: ''
|
||||
});
|
||||
const handleInputChange = (e, { name, value }) => {
|
||||
setInputs((inputs) => ({ ...inputs, [name]: value }));
|
||||
@@ -156,13 +157,11 @@ const EditChannel = () => {
|
||||
}, []);
|
||||
|
||||
const submit = async () => {
|
||||
// some provider as AWS need both AK and SK rather than a single key,
|
||||
// so we need to combine them into a single key to achieve the best compatibility.
|
||||
if (inputs.ak && inputs.sk) {
|
||||
console.log(`combine ak ${inputs.ak} and sk ${inputs.sk}`, inputs.ak, inputs.sk);
|
||||
inputs.key = `${inputs.ak}\n${inputs.sk}`;
|
||||
if (inputs.key === '') {
|
||||
if (config.ak !== '' && config.sk !== '' && config.region !== '') {
|
||||
inputs.key = `${config.ak}|${config.sk}|${config.region}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isEdit && (inputs.name === '' || inputs.key === '')) {
|
||||
showInfo('请填写渠道名称和渠道密钥!');
|
||||
return;
|
||||
@@ -356,6 +355,13 @@ const EditChannel = () => {
|
||||
</Form.Field>
|
||||
)
|
||||
}
|
||||
{
|
||||
inputs.type === 34 && (
|
||||
<Message>
|
||||
对于 Coze 而言,模型名称即 Bot ID,你可以添加一个前缀 `bot-`,例如:`bot-123456`。
|
||||
</Message>
|
||||
)
|
||||
}
|
||||
<Form.Field>
|
||||
<Form.Dropdown
|
||||
label='模型'
|
||||
@@ -446,6 +452,18 @@ const EditChannel = () => {
|
||||
</Form.Field>
|
||||
)
|
||||
}
|
||||
{
|
||||
inputs.type === 34 && (
|
||||
<Form.Input
|
||||
label='User ID'
|
||||
name='user_id'
|
||||
required
|
||||
placeholder={'生成该密钥的用户 ID'}
|
||||
onChange={handleConfigChange}
|
||||
value={config.user_id}
|
||||
autoComplete=''
|
||||
/>)
|
||||
}
|
||||
{
|
||||
inputs.type !== 33 && (batch ? <Form.Field>
|
||||
<Form.TextArea
|
||||
|
||||
Reference in New Issue
Block a user