From a55bc0c07cef0498e3e65c6b0605b6141c018f52 Mon Sep 17 00:00:00 2001 From: qingxu fu <505030475@qq.com> Date: Sat, 11 Nov 2023 23:22:09 +0800 Subject: [PATCH] =?UTF-8?q?AutoGen=E8=87=AA=E5=8A=A8=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=9A=84=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crazy_functions/agent_fns/pipe.py | 10 +++++++--- crazy_functions/多智能体.py | 5 ----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crazy_functions/agent_fns/pipe.py b/crazy_functions/agent_fns/pipe.py index 6ce9961a..bb3bc785 100644 --- a/crazy_functions/agent_fns/pipe.py +++ b/crazy_functions/agent_fns/pipe.py @@ -55,12 +55,14 @@ class PluginMultiprocessManager: def send_command(self, cmd): # ⭐ run in main process + repeated = False if cmd == self.last_user_input: - print('repeated input detected, ignore') + repeated = True cmd = "" else: self.last_user_input = cmd self.parent_conn.send(PipeCom("user_input", cmd)) + return repeated, cmd def immediate_showoff_when_possible(self, fp): # ⭐ 主进程 @@ -111,7 +113,7 @@ class PluginMultiprocessManager: if create_or_resume == 'create': self.cnt = 1 self.parent_conn = self.launch_subprocess_with_pipe() # ⭐⭐⭐ - self.send_command(txt) + repeated, cmd_to_autogen = self.send_command(txt) if txt == 'exit': self.chatbot.append([f"结束", "结束信号已明确,终止AutoGen程序。"]) yield from update_ui(chatbot=self.chatbot, history=self.history) @@ -143,7 +145,9 @@ class PluginMultiprocessManager: break if msg.cmd == "show": yield from self.overwatch_workdir_file_change() - self.chatbot.append([f"运行阶段-{self.cnt}", msg.content]) + notice = "" + if repeated: notice = "(自动忽略重复的输入)" + self.chatbot.append([f"运行阶段-{self.cnt}(上次用户反馈输入为: 「{cmd_to_autogen}」{notice}", msg.content]) self.cnt += 1 yield from update_ui(chatbot=self.chatbot, history=self.history) if msg.cmd == "interact": diff --git a/crazy_functions/多智能体.py b/crazy_functions/多智能体.py index 8b9a69cd..d2adee00 100644 --- a/crazy_functions/多智能体.py +++ b/crazy_functions/多智能体.py @@ -3,11 +3,6 @@ 测试: - show me the solution of $x^2=cos(x)$, solve this problem with figure, and plot and save image to t.jpg -Testing: - - Crop the image, keeping the bottom half. - - Swap the blue channel and red channel of the image. - - Convert the image to grayscale. - - Convert the CSV file to an Excel spreadsheet. """