chore: completion remove stream
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import apikeys from './en-US/apikeys';
|
||||||
import common from './en-US/common';
|
import common from './en-US/common';
|
||||||
import menu from './en-US/menu';
|
import menu from './en-US/menu';
|
||||||
import models from './en-US/models';
|
import models from './en-US/models';
|
||||||
@@ -9,5 +10,6 @@ export default {
|
|||||||
...menu,
|
...menu,
|
||||||
...models,
|
...models,
|
||||||
...playground,
|
...playground,
|
||||||
...resources
|
...resources,
|
||||||
|
...apikeys
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
'apikeys.title': 'API Keys',
|
'apikeys.title': 'API Keys',
|
||||||
'apikeys.button.create': 'New API Key',
|
'apikeys.button.create': 'New API Key',
|
||||||
'apikeys.form.expiretime': 'Expiration'
|
'apikeys.form.expiretime': 'Expiration',
|
||||||
|
'apikeys.table.name': 'Key Name'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import menu from './en-US/menu';
|
import menu from './en-US/menu';
|
||||||
|
import apikeys from './zh-CN/apikeys';
|
||||||
import common from './zh-CN/common';
|
import common from './zh-CN/common';
|
||||||
import models from './zh-CN/models';
|
import models from './zh-CN/models';
|
||||||
import playground from './zh-CN/playground';
|
import playground from './zh-CN/playground';
|
||||||
@@ -9,5 +10,6 @@ export default {
|
|||||||
...menu,
|
...menu,
|
||||||
...models,
|
...models,
|
||||||
...playground,
|
...playground,
|
||||||
...resources
|
...resources,
|
||||||
|
...apikeys
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
'apikeys.title': 'API 密钥',
|
'apikeys.title': 'API 密钥',
|
||||||
'apikeys.button.create': '新建 API 密钥',
|
'apikeys.button.create': '新建 API 密钥',
|
||||||
'apikeys.form.expiretime': '过期时间'
|
'apikeys.form.expiretime': '过期时间',
|
||||||
|
'apikeys.table.name': '密钥名称'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import useTableSort from '@/hooks/use-table-sort';
|
|||||||
import { handleBatchRequest } from '@/utils';
|
import { handleBatchRequest } from '@/utils';
|
||||||
import { DeleteOutlined, PlusOutlined, SyncOutlined } from '@ant-design/icons';
|
import { DeleteOutlined, PlusOutlined, SyncOutlined } from '@ant-design/icons';
|
||||||
import { PageContainer } from '@ant-design/pro-components';
|
import { PageContainer } from '@ant-design/pro-components';
|
||||||
|
import { useIntl } from '@umijs/max';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Input,
|
Input,
|
||||||
@@ -32,6 +33,7 @@ const Models: React.FC = () => {
|
|||||||
const { sortOrder, setSortOrder } = useTableSort({
|
const { sortOrder, setSortOrder } = useTableSort({
|
||||||
defaultSortOrder: 'descend'
|
defaultSortOrder: 'descend'
|
||||||
});
|
});
|
||||||
|
const intl = useIntl();
|
||||||
const [dataSource, setDataSource] = useState([]);
|
const [dataSource, setDataSource] = useState([]);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
const [openAddModal, setOpenAddModal] = useState(false);
|
const [openAddModal, setOpenAddModal] = useState(false);
|
||||||
@@ -114,7 +116,6 @@ const Models: React.FC = () => {
|
|||||||
const handleAddUser = () => {
|
const handleAddUser = () => {
|
||||||
setOpenAddModal(true);
|
setOpenAddModal(true);
|
||||||
setAction(PageAction.CREATE);
|
setAction(PageAction.CREATE);
|
||||||
setTitle('Add API Key');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleModalOk = async (data: FormData) => {
|
const handleModalOk = async (data: FormData) => {
|
||||||
@@ -209,7 +210,7 @@ const Models: React.FC = () => {
|
|||||||
<PageContainer
|
<PageContainer
|
||||||
ghost
|
ghost
|
||||||
header={{
|
header={{
|
||||||
title: 'API Keys'
|
title: intl.formatMessage({ id: 'apikeys.title' })
|
||||||
}}
|
}}
|
||||||
extra={[]}
|
extra={[]}
|
||||||
>
|
>
|
||||||
@@ -218,7 +219,7 @@ const Models: React.FC = () => {
|
|||||||
left={
|
left={
|
||||||
<Space>
|
<Space>
|
||||||
<Input
|
<Input
|
||||||
placeholder="名称查询"
|
placeholder={intl.formatMessage({ id: 'common.filter.name' })}
|
||||||
style={{ width: 300 }}
|
style={{ width: 300 }}
|
||||||
onChange={handleNameChange}
|
onChange={handleNameChange}
|
||||||
></Input>
|
></Input>
|
||||||
@@ -237,7 +238,7 @@ const Models: React.FC = () => {
|
|||||||
type="primary"
|
type="primary"
|
||||||
onClick={handleAddUser}
|
onClick={handleAddUser}
|
||||||
>
|
>
|
||||||
Add API Key
|
{intl.formatMessage({ id: 'apikeys.button.create' })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
icon={<DeleteOutlined />}
|
icon={<DeleteOutlined />}
|
||||||
@@ -245,7 +246,7 @@ const Models: React.FC = () => {
|
|||||||
onClick={handleDeleteBatch}
|
onClick={handleDeleteBatch}
|
||||||
disabled={!rowSelection.selectedRowKeys.length}
|
disabled={!rowSelection.selectedRowKeys.length}
|
||||||
>
|
>
|
||||||
Delete
|
{intl.formatMessage({ id: 'common.button.delete' })}
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
@@ -267,7 +268,7 @@ const Models: React.FC = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Column
|
<Column
|
||||||
title="Name"
|
title={intl.formatMessage({ id: 'apikeys.table.name' })}
|
||||||
dataIndex="name"
|
dataIndex="name"
|
||||||
key="name"
|
key="name"
|
||||||
width={400}
|
width={400}
|
||||||
@@ -278,7 +279,7 @@ const Models: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Column
|
<Column
|
||||||
title="Create Time"
|
title={intl.formatMessage({ id: 'common.table.createTime' })}
|
||||||
dataIndex="created_at"
|
dataIndex="created_at"
|
||||||
key="createTime"
|
key="createTime"
|
||||||
defaultSortOrder="descend"
|
defaultSortOrder="descend"
|
||||||
@@ -290,7 +291,7 @@ const Models: React.FC = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Column
|
<Column
|
||||||
title="Expiration"
|
title={intl.formatMessage({ id: 'apikeys.form.expiretime' })}
|
||||||
dataIndex="expires_at"
|
dataIndex="expires_at"
|
||||||
key="expiration"
|
key="expiration"
|
||||||
render={(text, record) => {
|
render={(text, record) => {
|
||||||
@@ -303,7 +304,9 @@ const Models: React.FC = () => {
|
|||||||
render={(text, record: ListItem) => {
|
render={(text, record: ListItem) => {
|
||||||
return (
|
return (
|
||||||
<Space size={20}>
|
<Space size={20}>
|
||||||
<Tooltip title="删除">
|
<Tooltip
|
||||||
|
title={intl.formatMessage({ id: 'common.button.delete' })}
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => handleDelete(record)}
|
onClick={() => handleDelete(record)}
|
||||||
size="small"
|
size="small"
|
||||||
@@ -321,7 +324,7 @@ const Models: React.FC = () => {
|
|||||||
<AddAPIKeyModal
|
<AddAPIKeyModal
|
||||||
open={openAddModal}
|
open={openAddModal}
|
||||||
action={action}
|
action={action}
|
||||||
title={title}
|
title={intl.formatMessage({ id: 'apikeys.button.create' })}
|
||||||
onCancel={handleModalCancel}
|
onCancel={handleModalCancel}
|
||||||
onOk={handleModalOk}
|
onOk={handleModalOk}
|
||||||
></AddAPIKeyModal>
|
></AddAPIKeyModal>
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ const MessageList: React.FC<MessageProps> = (props) => {
|
|||||||
...messageList
|
...messageList
|
||||||
]
|
]
|
||||||
: [...messageList],
|
: [...messageList],
|
||||||
...parameters,
|
...parameters
|
||||||
stream: true
|
|
||||||
};
|
};
|
||||||
const data = await execChatCompletions(chatParams);
|
const data = await execChatCompletions(chatParams);
|
||||||
const assistant = _.get(data, ['choices', '0', 'message']);
|
const assistant = _.get(data, ['choices', '0', 'message']);
|
||||||
@@ -197,7 +196,7 @@ const MessageList: React.FC<MessageProps> = (props) => {
|
|||||||
open={show}
|
open={show}
|
||||||
systemMessage={systemMessage}
|
systemMessage={systemMessage}
|
||||||
messageList={messageList}
|
messageList={messageList}
|
||||||
parameters={{ ...parameters, stream: true }}
|
parameters={parameters}
|
||||||
onCancel={handleCloseViewCode}
|
onCancel={handleCloseViewCode}
|
||||||
title={intl.formatMessage({ id: 'playground.viewcode' })}
|
title={intl.formatMessage({ id: 'playground.viewcode' })}
|
||||||
></ViewCodeModal>
|
></ViewCodeModal>
|
||||||
|
|||||||
Reference in New Issue
Block a user