mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-19 00:37:08 +00:00
Integrate Chat and Copilot into chat-sdk, and add SQL parse display (#166)
This commit is contained in:
14
webapp/packages/chat-sdk/src/demo/ChatDemo.tsx
Normal file
14
webapp/packages/chat-sdk/src/demo/ChatDemo.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import Chat from '../Chat';
|
||||
import styles from './style.module.less';
|
||||
|
||||
type Props = {};
|
||||
|
||||
const ChatDemo: React.FC<Props> = ({}) => {
|
||||
return (
|
||||
<div className={styles.chatDemo}>
|
||||
<Chat isDeveloper />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChatDemo;
|
||||
50
webapp/packages/chat-sdk/src/demo/CopilotDemo.tsx
Normal file
50
webapp/packages/chat-sdk/src/demo/CopilotDemo.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
import { Button, Space } from 'antd';
|
||||
import styles from './style.module.less';
|
||||
import Copilot from '../Copilot';
|
||||
import { useRef } from 'react';
|
||||
|
||||
const buttonParams = [
|
||||
{
|
||||
msg: '周杰伦 艺人趋势解读',
|
||||
agentId: 8,
|
||||
modelId: 23,
|
||||
filters: [{ bizName: 'singer_id', elementID: 283, value: 4558 }],
|
||||
},
|
||||
{
|
||||
msg: '林俊杰 艺人趋势解读',
|
||||
agentId: 8,
|
||||
modelId: 23,
|
||||
filters: [{ bizName: 'singer_id', elementID: 283, value: 4286 }],
|
||||
},
|
||||
];
|
||||
|
||||
const CopilotDemo = () => {
|
||||
const copilotRef = useRef<any>();
|
||||
|
||||
return (
|
||||
<div className={styles.copilotDemo}>
|
||||
<Space>
|
||||
{buttonParams.map(params => (
|
||||
<Button
|
||||
key={params.msg}
|
||||
onClick={() => {
|
||||
copilotRef?.current?.sendCopilotMsg(params);
|
||||
}}
|
||||
>
|
||||
{params.msg}
|
||||
</Button>
|
||||
))}
|
||||
</Space>
|
||||
<Copilot
|
||||
// token={localStorage.getItem('SUPERSONIC_TOKEN') || ''}
|
||||
// agentIds={[8]}
|
||||
isDeveloper
|
||||
// integrateSystem="c2"
|
||||
ref={copilotRef}
|
||||
// noInput
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CopilotDemo;
|
||||
@@ -8,4 +8,8 @@
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.chatDemo {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user