feat: 模型选择
This commit is contained in:
parent
4ec9b7d507
commit
1c63ef8b28
|
|
@ -1,4 +1,7 @@
|
|||
.WelcomePage {
|
||||
.TitleLabel {
|
||||
cursor: pointer;
|
||||
}
|
||||
.PageHeader {
|
||||
height: 30vh;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { PageContainer, ProForm, ProFormTextArea } from '@ant-design/pro-components';
|
||||
import { useModel } from '@umijs/max';
|
||||
import { Button, Divider, Dropdown, Flex, MenuProps, message, Space, Tag, theme } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { Button, Divider, Dropdown, Flex, message, Space, Tag, theme } from 'antd';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import './Welcome.less'
|
||||
import { FileSearchOutlined, GlobalOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { FileSearchOutlined, GlobalOutlined, PlusOutlined, RightOutlined } from '@ant-design/icons';
|
||||
import { TweenOneGroup } from 'rc-tween-one';
|
||||
|
||||
const tagGroupStyle: React.CSSProperties = {
|
||||
|
|
@ -15,12 +15,17 @@ const tagGroupStyle: React.CSSProperties = {
|
|||
marginTop: 16,
|
||||
};
|
||||
|
||||
type ModelItem = {
|
||||
label: string,
|
||||
key: string
|
||||
}
|
||||
|
||||
const Welcome: React.FC = () => {
|
||||
const { token } = theme.useToken();
|
||||
const { initialState } = useModel('@@initialState');
|
||||
const textAreaRef = useRef<any>(null);
|
||||
const [tools, setTools] = useState<any>([]);
|
||||
|
||||
const [model, setModel] = useState<ModelItem|null>(null);
|
||||
const textAreaFieldProps: any = {
|
||||
ref: textAreaRef,
|
||||
autoSize: {
|
||||
|
|
@ -78,6 +83,11 @@ const Welcome: React.FC = () => {
|
|||
}
|
||||
}
|
||||
|
||||
const modelsItems:ModelItem[]|any[] = [{
|
||||
key: 'chatgpt',
|
||||
label: 'ChatGtp'
|
||||
}]
|
||||
|
||||
const Tags = () => {
|
||||
if (tools?.length) {
|
||||
return (<>
|
||||
|
|
@ -103,8 +113,21 @@ const Welcome: React.FC = () => {
|
|||
return <></>
|
||||
}
|
||||
|
||||
const Title = () => (
|
||||
<Dropdown menu={{ items: modelsItems }} arrow className='TitleLabel'>
|
||||
<Flex align='center'>
|
||||
<span >{model?.label}</span>
|
||||
<RightOutlined style={{ fontSize: 16}}/>
|
||||
</Flex>
|
||||
</Dropdown>
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
setModel(modelsItems[0]);
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<PageContainer title={false} className='WelcomePage'>
|
||||
<PageContainer title={<Title/>} className='WelcomePage'>
|
||||
<Flex align='center' justify='center' vertical>
|
||||
<div className='PageHeader'></div>
|
||||
<div className='CenterCard'>
|
||||
|
|
|
|||
Loading…
Reference in New Issue