diff --git a/pilot/openapi/api_v1/editor/api_editor_v1.py b/pilot/openapi/api_v1/editor/api_editor_v1.py index 3fb985e91..e7637e582 100644 --- a/pilot/openapi/api_v1/editor/api_editor_v1.py +++ b/pilot/openapi/api_v1/editor/api_editor_v1.py @@ -105,12 +105,16 @@ async def get_editor_sql(con_uid: str, round: int): ) api_call = ApiCall() result = {} - result['thoughts'] = element["data"]["content"] - if api_call.check_last_plugin_call_ready(element["data"]["content"]): + result["thoughts"] = element["data"]["content"] + if api_call.check_last_plugin_call_ready( + element["data"]["content"] + ): api_call.update_from_context(element["data"]["content"]) if len(api_call.plugin_status_map) > 0: - first_item = next(iter(api_call.plugin_status_map.items()))[1] - result['sql'] = first_item.args["sql"] + first_item = next( + iter(api_call.plugin_status_map.items()) + )[1] + result["sql"] = first_item.args["sql"] return Result.succ(result) return Result.faild(msg="not have sql!") @@ -165,13 +169,17 @@ async def sql_editor_submit(sql_edit_context: ChatSqlEditContext = Body()): for element in edit_round["messages"]: if element["type"] == "ai": new_ai_text = element["data"]["content"] - new_ai_text.replace(sql_edit_context.old_sql, sql_edit_context.new_sql) + new_ai_text.replace( + sql_edit_context.old_sql, sql_edit_context.new_sql + ) element["data"]["content"] = new_ai_text for element in edit_round["messages"]: if element["type"] == "view": api_call = ApiCall() - new_view_text = api_call.run_display_sql(new_ai_text, conn.run_to_df) + new_view_text = api_call.run_display_sql( + new_ai_text, conn.run_to_df + ) element["data"]["content"] = new_view_text history_mem.update(history_messages) return Result.succ(None) diff --git a/pilot/scene/chat_db/auto_execute/chat.py b/pilot/scene/chat_db/auto_execute/chat.py index 01e04be63..b05480cdf 100644 --- a/pilot/scene/chat_db/auto_execute/chat.py +++ b/pilot/scene/chat_db/auto_execute/chat.py @@ -75,6 +75,7 @@ class ChatWithDbAutoExecute(BaseChat): text = text.replace("\n", " ") print(f"stream_plugin_call:{text}") return self.api_call.run_display_sql(text, self.database.run_to_df) + # # def do_action(self, prompt_response): # print(f"do_action:{prompt_response}")