mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-08 17:53:41 +08:00
Merge commit '2369025842b828ac38f4427fd1ebab8d03b1fe7f'
This commit is contained in:
@@ -38,7 +38,7 @@ const Footer = () => {
|
||||
) : (
|
||||
<div className='custom-footer'>
|
||||
<a
|
||||
href='https://github.com/songquanpeng/one-api'
|
||||
href='https://github.com/Laisky/one-api'
|
||||
target='_blank'
|
||||
>
|
||||
{systemName} {process.env.REACT_APP_VERSION}{' '}
|
||||
|
||||
@@ -90,7 +90,7 @@ const OtherSetting = () => {
|
||||
|
||||
const openGitHubRelease = () => {
|
||||
window.location =
|
||||
'https://github.com/songquanpeng/one-api/releases/latest';
|
||||
'https://github.com/Laisky/one-api/releases/latest';
|
||||
};
|
||||
|
||||
const checkUpdate = async () => {
|
||||
@@ -141,7 +141,7 @@ const OtherSetting = () => {
|
||||
<Form.Group widths='equal'>
|
||||
<Form.Input
|
||||
label={<label>主题名称(<Link
|
||||
to='https://github.com/songquanpeng/one-api/blob/main/web/README.md'>当前可用主题</Link>)</label>}
|
||||
to='https://github.com/Laisky/one-api/blob/main/web/README.md'>当前可用主题</Link>)</label>}
|
||||
placeholder='请输入主题名称'
|
||||
value={inputs.Theme}
|
||||
name='Theme'
|
||||
|
||||
@@ -37,8 +37,8 @@ const About = () => {
|
||||
<Header as='h3'>关于</Header>
|
||||
<p>可在设置页面设置关于内容,支持 HTML & Markdown</p>
|
||||
项目仓库地址:
|
||||
<a href='https://github.com/songquanpeng/one-api'>
|
||||
https://github.com/songquanpeng/one-api
|
||||
<a href='https://github.com/Laisky/one-api'>
|
||||
https://github.com/Laisky/one-api
|
||||
</a>
|
||||
</Segment>
|
||||
</> : <>
|
||||
|
||||
@@ -54,6 +54,11 @@ const EditChannel = () => {
|
||||
const [basicModels, setBasicModels] = useState([]);
|
||||
const [fullModels, setFullModels] = useState([]);
|
||||
const [customModel, setCustomModel] = useState('');
|
||||
const [config, setConfig] = useState({
|
||||
region: '',
|
||||
sk: '',
|
||||
ak: ''
|
||||
});
|
||||
const handleInputChange = (e, { name, value }) => {
|
||||
setInputs((inputs) => ({ ...inputs, [name]: value }));
|
||||
if (name === 'type') {
|
||||
@@ -65,6 +70,10 @@ const EditChannel = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleConfigChange = (e, { name, value }) => {
|
||||
setConfig((inputs) => ({ ...inputs, [name]: value }));
|
||||
};
|
||||
|
||||
const loadChannel = async () => {
|
||||
let res = await API.get(`/api/channel/${channelId}`);
|
||||
const { success, message, data } = res.data;
|
||||
@@ -83,6 +92,9 @@ const EditChannel = () => {
|
||||
data.model_mapping = JSON.stringify(JSON.parse(data.model_mapping), null, 2);
|
||||
}
|
||||
setInputs(data);
|
||||
if (data.config !== '') {
|
||||
setConfig(JSON.parse(data.config));
|
||||
}
|
||||
setBasicModels(getChannelModels(data.type));
|
||||
} else {
|
||||
showError(message);
|
||||
@@ -176,6 +188,7 @@ const EditChannel = () => {
|
||||
let res;
|
||||
localInputs.models = localInputs.models.join(',');
|
||||
localInputs.group = localInputs.groups.join(',');
|
||||
localInputs.config = JSON.stringify(config);
|
||||
if (isEdit) {
|
||||
res = await API.put(`/api/channel/`, { ...localInputs, id: parseInt(channelId) });
|
||||
} else {
|
||||
@@ -234,7 +247,7 @@ const EditChannel = () => {
|
||||
<Message>
|
||||
注意,<strong>模型部署名称必须和模型名称保持一致</strong>,因为 One API 会把请求体中的 model
|
||||
参数替换为你的部署名称(模型名称中的点会被剔除),<a target='_blank'
|
||||
href='https://github.com/songquanpeng/one-api/issues/133?notification_referrer_id=NT_kwDOAmJSYrM2NjIwMzI3NDgyOjM5OTk4MDUw#issuecomment-1571602271'>图片演示</a>。
|
||||
href='https://github.com/Laisky/one-api/issues/133?notification_referrer_id=NT_kwDOAmJSYrM2NjIwMzI3NDgyOjM5OTk4MDUw#issuecomment-1571602271'>图片演示</a>。
|
||||
</Message>
|
||||
<Form.Field>
|
||||
<Form.Input
|
||||
@@ -352,7 +365,9 @@ const EditChannel = () => {
|
||||
fluid
|
||||
multiple
|
||||
search
|
||||
onLabelClick={(e, { value }) => {copy(value).then()}}
|
||||
onLabelClick={(e, { value }) => {
|
||||
copy(value).then();
|
||||
}}
|
||||
selection
|
||||
onChange={handleInputChange}
|
||||
value={inputs.models}
|
||||
@@ -403,11 +418,11 @@ const EditChannel = () => {
|
||||
<Form.Field>
|
||||
<Form.Input
|
||||
label='Region'
|
||||
name='base_url'
|
||||
name='region'
|
||||
required
|
||||
placeholder={'region,e.g. us-west-2'}
|
||||
onChange={handleInputChange}
|
||||
value={inputs.base_url}
|
||||
onChange={handleConfigChange}
|
||||
value={config.region}
|
||||
autoComplete=''
|
||||
/>
|
||||
<Form.Input
|
||||
@@ -415,8 +430,8 @@ const EditChannel = () => {
|
||||
name='ak'
|
||||
required
|
||||
placeholder={'AWS IAM Access Key'}
|
||||
onChange={handleInputChange}
|
||||
value={inputs.ak}
|
||||
onChange={handleConfigChange}
|
||||
value={config.ak}
|
||||
autoComplete=''
|
||||
/>
|
||||
<Form.Input
|
||||
@@ -424,8 +439,8 @@ const EditChannel = () => {
|
||||
name='sk'
|
||||
required
|
||||
placeholder={'AWS IAM Secret Key'}
|
||||
onChange={handleInputChange}
|
||||
value={inputs.sk}
|
||||
onChange={handleConfigChange}
|
||||
value={config.sk}
|
||||
autoComplete=''
|
||||
/>
|
||||
</Form.Field>
|
||||
|
||||
@@ -69,10 +69,10 @@ const Home = () => {
|
||||
<p>
|
||||
源码:
|
||||
<a
|
||||
href='https://github.com/songquanpeng/one-api'
|
||||
href='https://github.com/Laisky/one-api'
|
||||
target='_blank'
|
||||
>
|
||||
https://github.com/songquanpeng/one-api
|
||||
https://github.com/Laisky/one-api
|
||||
</a>
|
||||
</p>
|
||||
<p>启动时间:{getStartTimeString()}</p>
|
||||
|
||||
Reference in New Issue
Block a user