mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-08 09:43:42 +08:00
Merge commit '2369025842b828ac38f4427fd1ebab8d03b1fe7f'
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
默认主题,由 [JustSong](https://github.com/songquanpeng) 开发。
|
||||
|
||||
预览:
|
||||
|||
|
||||
|||
|
||||
|:---:|:---:|
|
||||
|
||||
### 主题:berry
|
||||
@@ -32,9 +32,9 @@
|
||||
预览:
|
||||
|||
|
||||
|:---:|:---:|
|
||||
|||
|
||||
|||
|
||||
|||
|
||||
|||
|
||||
|||
|
||||
|||
|
||||
|
||||
### 主题:air
|
||||
由 [Calon](https://github.com/Calcium-Ion) 开发。
|
||||
@@ -44,4 +44,4 @@
|
||||
|
||||
#### 开发说明
|
||||
|
||||
请查看 [web/berry/README.md](https://github.com/songquanpeng/one-api/tree/main/web/berry/README.md)
|
||||
请查看 [web/berry/README.md](https://github.com/Laisky/one-api/tree/main/web/berry/README.md)
|
||||
|
||||
@@ -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>
|
||||
</> : <>
|
||||
|
||||
@@ -324,7 +324,7 @@ const EditChannel = (props) => {
|
||||
注意,<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>。
|
||||
</>
|
||||
}>
|
||||
</Banner>
|
||||
|
||||
@@ -73,10 +73,10 @@ const Home = () => {
|
||||
<p>
|
||||
源码:
|
||||
<a
|
||||
href='https://github.com/songquanpeng/one-api'
|
||||
href='https://github.com/Laisky/one-api'
|
||||
target='_blank' rel='noreferrer'
|
||||
>
|
||||
https://github.com/songquanpeng/one-api
|
||||
https://github.com/Laisky/one-api
|
||||
</a>
|
||||
</p>
|
||||
<p>启动时间:{getStartTimeString()}</p>
|
||||
@@ -127,4 +127,4 @@ const Home = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
||||
export default Home;
|
||||
|
||||
@@ -15,7 +15,7 @@ const Footer = () => {
|
||||
<div className="custom-footer" dangerouslySetInnerHTML={{ __html: siteInfo.footer_html }}></div>
|
||||
) : (
|
||||
<>
|
||||
<Link href="https://github.com/songquanpeng/one-api" target="_blank">
|
||||
<Link href="https://github.com/Laisky/one-api" target="_blank">
|
||||
{siteInfo.system_name} {process.env.REACT_APP_VERSION}{' '}
|
||||
</Link>
|
||||
由{' '}
|
||||
|
||||
@@ -41,7 +41,7 @@ const About = () => {
|
||||
<Typography variant="body2">
|
||||
可在设置页面设置关于内容,支持 HTML & Markdown <br />
|
||||
项目仓库地址:
|
||||
<a href="https://github.com/songquanpeng/one-api">https://github.com/songquanpeng/one-api</a>
|
||||
<a href="https://github.com/Laisky/one-api">https://github.com/Laisky/one-api</a>
|
||||
</Typography>
|
||||
</MainCard>
|
||||
</Container>
|
||||
|
||||
@@ -26,7 +26,7 @@ const BaseIndex = () => (
|
||||
<Button
|
||||
variant="contained"
|
||||
startIcon={<GitHub />}
|
||||
href="https://github.com/songquanpeng/one-api"
|
||||
href="https://github.com/Laisky/one-api"
|
||||
target="_blank"
|
||||
sx={{ backgroundColor: '#24292e', color: '#fff', width: 'fit-content', boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)' }}
|
||||
>
|
||||
|
||||
@@ -106,7 +106,7 @@ const OtherSetting = () => {
|
||||
};
|
||||
|
||||
const openGitHubRelease = () => {
|
||||
window.location = 'https://github.com/songquanpeng/one-api/releases/latest';
|
||||
window.location = 'https://github.com/Laisky/one-api/releases/latest';
|
||||
};
|
||||
|
||||
const checkUpdate = async () => {
|
||||
|
||||
@@ -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