From d5eed516ced17e9e4e8da2b4cb5734178cd04c53 Mon Sep 17 00:00:00 2001 From: matija-ilijas Date: Fri, 13 Sep 2024 14:57:15 +0200 Subject: [PATCH] Added test instructions sending to UI --- core/agents/troubleshooter.py | 6 ++++-- core/ui/base.py | 8 ++++++++ core/ui/console.py | 3 +++ core/ui/ipc_client.py | 9 +++++++++ core/ui/virtual.py | 3 +++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/core/agents/troubleshooter.py b/core/agents/troubleshooter.py index 9f509c93a9..ddd192609b 100644 --- a/core/agents/troubleshooter.py +++ b/core/agents/troubleshooter.py @@ -72,7 +72,9 @@ class Troubleshooter(IterationPromptMixin, RelevantFilesMixin, BaseAgent): self.next_state.flag_tasks_as_modified() return AgentResponse.done(self) else: - await self.send_message("Here are instruction on how to test the app:\n\n" + user_instructions) + await self.send_message("Here are instructions on how to test the app:\n\n" + user_instructions) + + await self.ui.send_test_instructions(user_instructions) # Developer sets iteration as "completed" when it generates the step breakdown, so we can't # use "current_iteration" here @@ -177,7 +179,7 @@ class Troubleshooter(IterationPromptMixin, RelevantFilesMixin, BaseAgent): route_files = await self._get_route_files() - llm = self.get_llm(stream_output=True) + llm = self.get_llm() convo = self._get_task_convo().template( "define_user_review_goal", task=self.current_state.current_task, route_files=route_files ) diff --git a/core/ui/base.py b/core/ui/base.py index b967a7e954..953ff5e4fb 100644 --- a/core/ui/base.py +++ b/core/ui/base.py @@ -316,6 +316,14 @@ class UIBase: """ raise NotImplementedError() + async def send_test_instructions(self, test_instructions: str): + """ + Send test instructions. + + :param test_instructions: Test instructions. + """ + raise NotImplementedError() + async def send_file_status(self, file_path: str, file_status: str): """ Send file status. diff --git a/core/ui/console.py b/core/ui/console.py index 84e1da003e..f79ffbf34e 100644 --- a/core/ui/console.py +++ b/core/ui/console.py @@ -154,6 +154,9 @@ class PlainConsoleUI(UIBase): async def send_project_stats(self, stats: dict): pass + async def send_test_instructions(self, test_instructions: str): + pass + async def send_file_status(self, file_path: str, file_status: str): pass diff --git a/core/ui/ipc_client.py b/core/ui/ipc_client.py index 6494e2e4c8..f13853d147 100644 --- a/core/ui/ipc_client.py +++ b/core/ui/ipc_client.py @@ -49,6 +49,7 @@ class MessageType(str, Enum): EPICS_AND_TASKS = "epicsAndTasks" MODIFIED_FILES = "modifiedFiles" IMPORTANT_STREAM = "importantStream" + TEST_INSTRUCTIONS = "testInstructions" class Message(BaseModel): @@ -418,6 +419,14 @@ class IPCClientUI(UIBase): content=stats, ) + async def send_test_instructions(self, test_instructions: str): + await self._send( + MessageType.TEST_INSTRUCTIONS, + content={ + "test_instructions": test_instructions, + }, + ) + async def send_file_status(self, file_path: str, file_status: str): await self._send( MessageType.FILE_STATUS, diff --git a/core/ui/virtual.py b/core/ui/virtual.py index c6246f0ee5..ed03e3e415 100644 --- a/core/ui/virtual.py +++ b/core/ui/virtual.py @@ -150,6 +150,9 @@ class VirtualUI(UIBase): async def send_project_stats(self, stats: dict): pass + async def send_test_instructions(self, test_instructions: str): + pass + async def send_file_status(self, file_path: str, file_status: str): pass