feat: 令牌聊天新增ChatGPT Web & Midjourney支持

This commit is contained in:
CaIon 2024-01-21 17:43:40 +08:00
parent f73a180fc3
commit c59a33e8e9
2 changed files with 15 additions and 11 deletions

View File

@ -183,7 +183,7 @@ const OperationSetting = () => {
placeholder='例如发卡网站的购买链接'
/>
<Form.Input
label='聊天页面链接'
label='默认聊天页面链接'
name='ChatLink'
onChange={handleInputChange}
autoComplete='new-password'
@ -198,7 +198,7 @@ const OperationSetting = () => {
autoComplete='new-password'
value={inputs.ChatLink2}
type='link'
placeholder='例如 ChatGPT Next Web 的部署地址'
placeholder='例如 ChatGPT Web & Midjourney 的部署地址'
/>
<Form.Input
label='单位美元额度'

View File

@ -66,7 +66,8 @@ const TokensTable = () => {
const link_menu = [
{node: 'item', key: 'next', name: 'ChatGPT Next Web', onClick: () => {onOpenLink('next')}},
{node: 'item', key: 'ama', name: 'ChatGPT Web & Midjourney', value: 'ama'},
{node: 'item', key: 'ama', name: 'AMA 问天', value: 'ama'},
{node: 'item', key: 'next-mj', name: 'ChatGPT Web & Midjourney', value: 'next-mj', onClick: () => {onOpenLink('next-mj')}},
{node: 'item', key: 'opencat', name: 'OpenCat', value: 'opencat'},
];
@ -154,8 +155,9 @@ const TokensTable = () => {
<Button theme="light" style={{ color: 'rgba(var(--semi-teal-7), 1)' }} onClick={()=>{onOpenLink('next', record.key)}}>聊天</Button>
<Dropdown trigger="click" position="bottomRight" menu={
[
{node: 'item', key: 'next', name: 'ChatGPT Next Web', onClick: () => {onOpenLink('next', record.key)}},
{node: 'item', key: 'ama', name: 'ChatGPT Web & Midjourney', onClick: () => {onOpenLink('ama', record.key)}},
{node: 'item', key: 'next', disabled: !localStorage.getItem('chat_link'), name: 'ChatGPT Next Web', onClick: () => {onOpenLink('next', record.key)}},
{node: 'item', key: 'next-mj', disabled: !localStorage.getItem('chat_link2'), name: 'ChatGPT Web & Midjourney', onClick: () => {onOpenLink('next-mj', record.key)}},
{node: 'item', key: 'ama', name: 'AMA 问天BotGrem', onClick: () => {onOpenLink('ama', record.key)}},
{node: 'item', key: 'opencat', name: 'OpenCat', onClick: () => {onOpenLink('opencat', record.key)}},
]
}
@ -346,21 +348,23 @@ const TokensTable = () => {
if (chatLink) {
defaultUrl = chatLink + `/#/?settings={"key":"sk-${key}","url":"${serverAddress}"}`;
} else {
showError('管理员未设置聊天链接')
return
}
let url;
switch (type) {
case 'ama':
url = mjLink + `/#/?settings={"key":"sk-${key}","url":"${serverAddress}"}`;
url = `ama://set-api-key?server=${encodedServerAddress}&key=sk-${key}`;
break;
case 'opencat':
url = `opencat://team/join?domain=${encodedServerAddress}&token=sk-${key}`;
break;
case 'next-mj':
url = mjLink + `/#/?settings={"key":"sk-${key}","url":"${serverAddress}"}`;
break;
default:
if (!chatLink) {
showError('管理员未设置聊天链接')
return;
}
url = defaultUrl;
}