|
@@ -655,15 +655,74 @@ export function ChatActions(props: {
|
|
|
setGuessList([]);
|
|
setGuessList([]);
|
|
|
}
|
|
}
|
|
|
}, [props.isClickStop])
|
|
}, [props.isClickStop])
|
|
|
|
|
+ const [activeKey, setActiveKey]= useState('0'); // 控制手风琴是否展示
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div className={styles["chat-input-actions"]}>
|
|
<div className={styles["chat-input-actions"]}>
|
|
|
{
|
|
{
|
|
|
|
|
+ props.sendStatus &&
|
|
|
|
|
+ <Collapse
|
|
|
|
|
+ accordion={true}
|
|
|
|
|
+ activeKey={activeKey}
|
|
|
|
|
+ onChange={(key)=>{setActiveKey(key[0])}}
|
|
|
|
|
+ bordered={false}
|
|
|
|
|
+ style={{ width: '100%',backgroundColor:'#fff' }}
|
|
|
|
|
+ expandIconPosition="end"
|
|
|
|
|
+ items={[
|
|
|
|
|
+ {
|
|
|
|
|
+ key: '1',
|
|
|
|
|
+ label:<span style={{ color: '#8096ca' }}>你还可以尝试提问:</span>,
|
|
|
|
|
+ children: <div style={{ color: '#8096ca', fontSize: 13, overflowX: 'auto' }}>
|
|
|
|
|
+ {/* <div>
|
|
|
|
|
+ 你还可以尝试提问:
|
|
|
|
|
+ </div> */}
|
|
|
|
|
+
|
|
|
|
|
+ {
|
|
|
|
|
+ guessList.length === 0 ?
|
|
|
|
|
+ <Space style={{ margin: '10px 0' }}>
|
|
|
|
|
+ <Skeleton.Button size="small" active={true} />
|
|
|
|
|
+ <Skeleton.Button size="small" active={true} />
|
|
|
|
|
+ <Skeleton.Button size="small" active={true} />
|
|
|
|
|
+ </Space>
|
|
|
|
|
+ :
|
|
|
|
|
+ <div style={{ display: 'flex', margin: '10px 0', overflowX: 'auto' }}>
|
|
|
|
|
+ {
|
|
|
|
|
+ guessList.map((item, index) => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div
|
|
|
|
|
+ style={{
|
|
|
|
|
+ padding: '5px 10px',
|
|
|
|
|
+ background: '#f2f4f8',
|
|
|
|
|
+ borderRadius: 5,
|
|
|
|
|
+ margin: '0 10px 10px 0',
|
|
|
|
|
+ cursor: 'pointer',
|
|
|
|
|
+ }}
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ props.setUserInput(item);
|
|
|
|
|
+ props.doSubmit(item)
|
|
|
|
|
+ setActiveKey('')
|
|
|
|
|
+ }}
|
|
|
|
|
+ key={index}
|
|
|
|
|
+ >
|
|
|
|
|
+ {item}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ </div>
|
|
|
|
|
+ }
|
|
|
|
|
+ </div>
|
|
|
|
|
+ }
|
|
|
|
|
+ ]}
|
|
|
|
|
+ />
|
|
|
|
|
+ }
|
|
|
|
|
+ {/* {
|
|
|
props.sendStatus &&
|
|
props.sendStatus &&
|
|
|
<div style={{ color: '#8096ca', fontSize: 13, overflowX: 'auto' }}>
|
|
<div style={{ color: '#8096ca', fontSize: 13, overflowX: 'auto' }}>
|
|
|
<div>
|
|
<div>
|
|
|
你还可以尝试提问:
|
|
你还可以尝试提问:
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
{
|
|
{
|
|
|
guessList.length === 0 ?
|
|
guessList.length === 0 ?
|
|
|
<Space style={{ margin: '10px 0' }}>
|
|
<Space style={{ margin: '10px 0' }}>
|
|
@@ -698,7 +757,7 @@ export function ChatActions(props: {
|
|
|
</div>
|
|
</div>
|
|
|
}
|
|
}
|
|
|
</div>
|
|
</div>
|
|
|
- }
|
|
|
|
|
|
|
+ } */}
|
|
|
{/* {couldStop && (
|
|
{/* {couldStop && (
|
|
|
<ChatAction
|
|
<ChatAction
|
|
|
onClick={stopAll}
|
|
onClick={stopAll}
|
|
@@ -1162,6 +1221,7 @@ function _Chat() {
|
|
|
|
|
|
|
|
const doSubmit = (userInput: string) => {
|
|
const doSubmit = (userInput: string) => {
|
|
|
if (userInput.trim() === "") return;
|
|
if (userInput.trim() === "") return;
|
|
|
|
|
+
|
|
|
const matchCommand = chatCommands.match(userInput);
|
|
const matchCommand = chatCommands.match(userInput);
|
|
|
if (matchCommand.matched) {
|
|
if (matchCommand.matched) {
|
|
|
setUserInput("");
|
|
setUserInput("");
|
|
@@ -1170,6 +1230,7 @@ function _Chat() {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
setIsLoading(true);
|
|
setIsLoading(true);
|
|
|
|
|
+ // debugger
|
|
|
chatStore.onUserInput([], userInput, attachImages).then(() => setIsLoading(false));
|
|
chatStore.onUserInput([], userInput, attachImages).then(() => setIsLoading(false));
|
|
|
setAttachImages([]);
|
|
setAttachImages([]);
|
|
|
localStorage.setItem(LAST_INPUT_KEY, userInput);
|
|
localStorage.setItem(LAST_INPUT_KEY, userInput);
|
|
@@ -2019,9 +2080,10 @@ function _Chat() {
|
|
|
items={[
|
|
items={[
|
|
|
{
|
|
{
|
|
|
key: '1',
|
|
key: '1',
|
|
|
- label: `查询到“${message.sliceInfo.doc.length}条”相关切片`,
|
|
|
|
|
|
|
+ // label: `查询到“${message.sliceInfo?.doc?.length}条”相关切片`,
|
|
|
|
|
+ label: `查询到${message.sliceInfo?.doc?.length}个问答共${message.sliceInfo?.allChunkNum}条切片`,
|
|
|
children: <div>
|
|
children: <div>
|
|
|
- {message.sliceInfo.doc.map((item, index) => {
|
|
|
|
|
|
|
+ {message.sliceInfo?.doc?.map((item, index) => {
|
|
|
return <div
|
|
return <div
|
|
|
style={{
|
|
style={{
|
|
|
padding: 10,
|
|
padding: 10,
|
|
@@ -2036,7 +2098,7 @@ function _Chat() {
|
|
|
key={item.doc_id}
|
|
key={item.doc_id}
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
setDrawerData({
|
|
setDrawerData({
|
|
|
- knowledge_id: message.sliceInfo!.knowledge_id,
|
|
|
|
|
|
|
+ knowledge_id: item!.knowledge_id,
|
|
|
doc_name: item.doc_name,
|
|
doc_name: item.doc_name,
|
|
|
chunk_info: {
|
|
chunk_info: {
|
|
|
doc_id: item.doc_id,
|
|
doc_id: item.doc_id,
|