feat: add OpenAI compatible channel (close #2091)

This commit is contained in:
JustSong
2025-02-16 17:38:06 +08:00
parent 8b8cd03e85
commit cafd0a0327
7 changed files with 94 additions and 57 deletions

View File

@@ -1,6 +1,6 @@
import React, {useEffect, useState} from 'react';
import {useTranslation} from 'react-i18next';
import {Button, Card, Form, Input, Message,} from 'semantic-ui-react';
import {Button, Card, Form, Input, Message} from 'semantic-ui-react';
import {useNavigate, useParams} from 'react-router-dom';
import {API, copy, getChannelModels, showError, showInfo, showSuccess, verifyJSON,} from '../../helpers';
import {CHANNEL_OPTIONS} from '../../constants';
@@ -339,6 +339,20 @@ const EditChannel = () => {
{inputs.type === 8 && (
<Form.Field>
<Form.Input
required
label={t('channel.edit.proxy_url')}
name='base_url'
placeholder={t('channel.edit.proxy_url_placeholder')}
onChange={handleInputChange}
value={inputs.base_url}
autoComplete='new-password'
/>
</Form.Field>
)}
{inputs.type === 50 && (
<Form.Field>
<Form.Input
required
label={t('channel.edit.base_url')}
name='base_url'
placeholder={t('channel.edit.base_url_placeholder')}
@@ -637,12 +651,13 @@ const EditChannel = () => {
{inputs.type !== 3 &&
inputs.type !== 33 &&
inputs.type !== 8 &&
inputs.type !== 50 &&
inputs.type !== 22 && (
<Form.Field>
<Form.Input
label={t('channel.edit.base_url')}
label={t('channel.edit.proxy_url')}
name='base_url'
placeholder={t('channel.edit.base_url_placeholder')}
placeholder={t('channel.edit.proxy_url_placeholder')}
onChange={handleInputChange}
value={inputs.base_url}
autoComplete='new-password'