mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-19 08:50:57 +00:00
(feature)(webapp) use nativeQuery field to determine whether it is a selection (#222)
This commit is contained in:
@@ -2,7 +2,7 @@ import { Input } from 'antd';
|
||||
import styles from './style.module.less';
|
||||
import { useEffect, useState } from 'react';
|
||||
import ChatItem from '../components/ChatItem';
|
||||
import { searchRecommend } from '../service';
|
||||
import { MsgDataType } from '../common/type';
|
||||
|
||||
const { Search } = Input;
|
||||
|
||||
@@ -10,8 +10,9 @@ const Chat = () => {
|
||||
const [data, setData] = useState<any>();
|
||||
const [inputMsg, setInputMsg] = useState('');
|
||||
const [msg, setMsg] = useState('');
|
||||
const [followQuestions, setFollowQuestions] = useState<string[]>([]);
|
||||
const [triggerResize, setTriggerResize] = useState(false);
|
||||
const [executeItemNode, setExecuteItemNode] = useState<React.ReactNode>();
|
||||
const [chatItemVisible, setChatItemVisible] = useState(false);
|
||||
|
||||
const onWindowResize = () => {
|
||||
setTriggerResize(true);
|
||||
@@ -34,14 +35,24 @@ const Chat = () => {
|
||||
|
||||
const onSearch = () => {
|
||||
setMsg(inputMsg);
|
||||
setChatItemVisible(false);
|
||||
setTimeout(() => {
|
||||
setChatItemVisible(true);
|
||||
}, 200);
|
||||
};
|
||||
|
||||
const onMsgDataLoaded = (msgData: any) => {
|
||||
const onMsgDataLoaded = (msgData: MsgDataType) => {
|
||||
setData(msgData);
|
||||
setFollowQuestions(['测试1234测试', '测试1234测试', '测试1234测试']);
|
||||
const { queryColumns, queryResults, queryMode } = msgData;
|
||||
const songIds = queryColumns.some(column => column.nameEn === 'zyqk_song_id')
|
||||
? (queryResults || []).map(result => result['zyqk_song_id'])
|
||||
: [];
|
||||
if (queryMode === 'DSL') {
|
||||
setExecuteItemNode(<>test</>);
|
||||
}
|
||||
};
|
||||
|
||||
// 5: 查信息,6: 智能圈选
|
||||
//预发环境: 5: 查信息,6: 智能圈选,12:问指标,15:歌曲库,16:艺人库
|
||||
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
@@ -53,15 +64,19 @@ const Chat = () => {
|
||||
onSearch={onSearch}
|
||||
/>
|
||||
</div>
|
||||
{inputMsg && (
|
||||
{msg && chatItemVisible && (
|
||||
<div className={styles.chatItem}>
|
||||
<ChatItem
|
||||
msg={msg}
|
||||
// msgData={data}
|
||||
agentId={6}
|
||||
agentId={5}
|
||||
conversationId={112211121}
|
||||
onMsgDataLoaded={onMsgDataLoaded}
|
||||
isLastMessage
|
||||
triggerResize={triggerResize}
|
||||
integrateSystem="wiki"
|
||||
executeItemNode={executeItemNode}
|
||||
isDeveloper
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -35,14 +35,7 @@ const CopilotDemo = () => {
|
||||
</Button>
|
||||
))}
|
||||
</Space>
|
||||
<Copilot
|
||||
// token={localStorage.getItem('SUPERSONIC_TOKEN') || ''}
|
||||
// agentIds={[8]}
|
||||
isDeveloper
|
||||
// integrateSystem="c2"
|
||||
ref={copilotRef}
|
||||
// noInput
|
||||
/>
|
||||
<Copilot isDeveloper ref={copilotRef} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user