Merge commit '2369025842b828ac38f4427fd1ebab8d03b1fe7f'

This commit is contained in:
Laisky.Cai
2024-04-20 01:07:29 +00:00
139 changed files with 2642 additions and 2625 deletions

View File

@@ -22,7 +22,7 @@
默认主题,由 [JustSong](https://github.com/songquanpeng) 开发。
预览:
|![image](https://github.com/songquanpeng/one-api/assets/39998050/ccfbc668-3a7f-4bc1-87da-7eacfd7bf371)|![image](https://github.com/songquanpeng/one-api/assets/39998050/a63ed547-44b9-45db-b43a-ecea07d60840)|
|![image](https://github.com/Laisky/one-api/assets/39998050/ccfbc668-3a7f-4bc1-87da-7eacfd7bf371)|![image](https://github.com/Laisky/one-api/assets/39998050/a63ed547-44b9-45db-b43a-ecea07d60840)|
|:---:|:---:|
### 主题berry
@@ -32,9 +32,9 @@
预览:
|||
|:---:|:---:|
|![image](https://github.com/songquanpeng/one-api/assets/42402987/36aff5c6-c5ff-4a90-8e3d-33d5cff34cbf)|![image](https://github.com/songquanpeng/one-api/assets/42402987/9ac63b36-5140-4064-8fad-fc9d25821509)|
|![image](https://github.com/songquanpeng/one-api/assets/42402987/fb2b1c64-ef24-4027-9b80-0cd9d945a47f)|![image](https://github.com/songquanpeng/one-api/assets/42402987/b6b649ec-2888-4324-8b2d-d5e11554eed6)|
|![image](https://github.com/songquanpeng/one-api/assets/42402987/6d3b22e0-436b-4e26-8911-bcc993c6a2bd)|![image](https://github.com/songquanpeng/one-api/assets/42402987/eef1e224-7245-44d7-804e-9d1c8fa3f29c)|
|![image](https://github.com/Laisky/one-api/assets/42402987/36aff5c6-c5ff-4a90-8e3d-33d5cff34cbf)|![image](https://github.com/Laisky/one-api/assets/42402987/9ac63b36-5140-4064-8fad-fc9d25821509)|
|![image](https://github.com/Laisky/one-api/assets/42402987/fb2b1c64-ef24-4027-9b80-0cd9d945a47f)|![image](https://github.com/Laisky/one-api/assets/42402987/b6b649ec-2888-4324-8b2d-d5e11554eed6)|
|![image](https://github.com/Laisky/one-api/assets/42402987/6d3b22e0-436b-4e26-8911-bcc993c6a2bd)|![image](https://github.com/Laisky/one-api/assets/42402987/eef1e224-7245-44d7-804e-9d1c8fa3f29c)|
### 主题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)

View File

@@ -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}{' '}

View File

@@ -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'

View File

@@ -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>
</> : <>

View File

@@ -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>

View File

@@ -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;

View File

@@ -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>
{' '}

View File

@@ -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>

View File

@@ -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)' }}
>

View File

@@ -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 () => {

View File

@@ -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}{' '}

View File

@@ -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'

View File

@@ -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>
</> : <>

View File

@@ -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={'regione.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>

View File

@@ -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>