|
@@ -152,6 +152,20 @@ const Home: React.FC = () => {
|
|
setbtnLoading(false);
|
|
setbtnLoading(false);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取历史记录的结构数据
|
|
|
|
+ * @param list
|
|
|
|
+ */
|
|
|
|
+ const getHistory = (list: any) => {
|
|
|
|
+ const rtnList: any[] = [];
|
|
|
|
+ for (let i = 0; i < list?.length; i++) {
|
|
|
|
+ rtnList.push({ role: '用户', text: list[i].problem, time: '' });
|
|
|
|
+ rtnList.push({ role: '聊天机器人', text: list[i].rtnResult, time: '' });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return rtnList;
|
|
|
|
+ };
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取闲聊的搜索结果
|
|
* 获取闲聊的搜索结果
|
|
*/
|
|
*/
|
|
@@ -169,8 +183,7 @@ const Home: React.FC = () => {
|
|
{
|
|
{
|
|
text_id: getUuid(),
|
|
text_id: getUuid(),
|
|
text: content,
|
|
text: content,
|
|
- history:
|
|
|
|
- curDialogue?.msgList?.map((item: any) => item.problem) || [],
|
|
|
|
|
|
+ history: getHistory(curDialogue?.msgList),
|
|
},
|
|
},
|
|
],
|
|
],
|
|
}),
|
|
}),
|