mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-29 23:01:38 +00:00
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com> Co-authored-by: 谨欣 <echo.cmy@antgroup.com> Co-authored-by: 严志勇 <yanzhiyong@tiansuixiansheng.com> Co-authored-by: yanzhiyong <932374019@qq.com>
36 lines
937 B
TypeScript
36 lines
937 B
TypeScript
import { ChatContext } from '@/app/chat-context';
|
|
import { StarsSvg } from '@/components/icons';
|
|
import Icon, { AppstoreFilled } from '@ant-design/icons';
|
|
import { Radio } from 'antd';
|
|
import { useContext } from 'react';
|
|
import './index.css';
|
|
|
|
export default function ModeTab() {
|
|
const { isContract, setIsContract, scene } = useContext(ChatContext);
|
|
const isShow = scene && ['chat_with_db_execute', 'chat_dashboard'].includes(scene as string);
|
|
|
|
if (!isShow) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Radio.Group
|
|
value={isContract}
|
|
defaultValue={true}
|
|
buttonStyle='solid'
|
|
onChange={() => {
|
|
setIsContract(!isContract);
|
|
}}
|
|
>
|
|
<Radio.Button value={false}>
|
|
<Icon component={StarsSvg} className='mr-1' />
|
|
Preview
|
|
</Radio.Button>
|
|
<Radio.Button value={true}>
|
|
<AppstoreFilled className='mr-1' />
|
|
Editor
|
|
</Radio.Button>
|
|
</Radio.Group>
|
|
);
|
|
}
|