From 08d86c4a95e159c5e98eade0f6e57319b935ad4d Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Wed, 23 Aug 2023 11:44:11 +0800 Subject: [PATCH] feat(editor): ChatExcel ChatExcel devlop part 4 --- pilot/openapi/api_v1/api_v1.py | 7 ++++++- pilot/scene/chat_data/chat_excel/excel_analyze/chat.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pilot/openapi/api_v1/api_v1.py b/pilot/openapi/api_v1/api_v1.py index 0d19c3838..cb7fc1145 100644 --- a/pilot/openapi/api_v1/api_v1.py +++ b/pilot/openapi/api_v1/api_v1.py @@ -1,3 +1,4 @@ +import json import uuid import asyncio import os @@ -122,16 +123,20 @@ async def db_support_types(): async def dialogue_list(user_id: str = None): dialogues: List = [] datas = DuckdbHistoryMemory.conv_list(user_id) - for item in datas: conv_uid = item.get("conv_uid") summary = item.get("summary") 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_uid=conv_uid, user_input=summary, chat_mode=chat_mode, + select_param=select_param ) dialogues.append(conv_vo) diff --git a/pilot/scene/chat_data/chat_excel/excel_analyze/chat.py b/pilot/scene/chat_data/chat_excel/excel_analyze/chat.py index 0e7c3f9ac..8369074d1 100644 --- a/pilot/scene/chat_data/chat_excel/excel_analyze/chat.py +++ b/pilot/scene/chat_data/chat_excel/excel_analyze/chat.py @@ -87,9 +87,9 @@ class ChatExcel(BaseChat): return None chat_param = { "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, - "select_param": self.select_param, + "select_param":self.excel_reader.excel_file_name, "excel_reader": self.excel_reader } learn_chat = ExcelLearning(**chat_param)