feat(editor): ChatExcel

ChatExcel devlop part 4
This commit is contained in:
yhjun1026 2023-08-23 11:44:11 +08:00
parent c67e6d1a65
commit 08d86c4a95
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,4 @@
import json
import uuid import uuid
import asyncio import asyncio
import os import os
@ -122,16 +123,20 @@ async def db_support_types():
async def dialogue_list(user_id: str = None): async def dialogue_list(user_id: str = None):
dialogues: List = [] dialogues: List = []
datas = DuckdbHistoryMemory.conv_list(user_id) datas = DuckdbHistoryMemory.conv_list(user_id)
for item in datas: for item in datas:
conv_uid = item.get("conv_uid") conv_uid = item.get("conv_uid")
summary = item.get("summary") summary = item.get("summary")
chat_mode = item.get("chat_mode") chat_mode = item.get("chat_mode")
messages = json.loads(item.get("messages"))
last_round = max(messages, key=lambda x: x['chat_order'])
select_param = last_round["param_value"]
conv_vo: ConversationVo = ConversationVo( conv_vo: ConversationVo = ConversationVo(
conv_uid=conv_uid, conv_uid=conv_uid,
user_input=summary, user_input=summary,
chat_mode=chat_mode, chat_mode=chat_mode,
select_param=select_param
) )
dialogues.append(conv_vo) dialogues.append(conv_vo)

View File

@ -87,9 +87,9 @@ class ChatExcel(BaseChat):
return None return None
chat_param = { chat_param = {
"chat_session_id": self.chat_session_id, "chat_session_id": self.chat_session_id,
"user_input": "[" + self.excel_reader.excel_file_name + self.excel_reader.extension +"]" + " analysis", "user_input": "[" + self.excel_reader.excel_file_name + self.excel_reader.extension +"]" + " Analysis",
"parent_mode": self.chat_mode, "parent_mode": self.chat_mode,
"select_param": self.select_param, "select_param":self.excel_reader.excel_file_name,
"excel_reader": self.excel_reader "excel_reader": self.excel_reader
} }
learn_chat = ExcelLearning(**chat_param) learn_chat = ExcelLearning(**chat_param)