From c0dfd12cc2caf1a021f7d1b6059575678fe96e5c Mon Sep 17 00:00:00 2001 From: matija-ilijas Date: Tue, 19 Nov 2024 15:21:03 +0100 Subject: [PATCH] added optional verbose mode in ask question msg --- core/agents/base.py | 2 ++ core/agents/spec_writer.py | 1 + core/ui/base.py | 1 + core/ui/console.py | 1 + core/ui/ipc_client.py | 3 ++- core/ui/virtual.py | 1 + tests/agents/test_base.py | 1 + 7 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/agents/base.py b/core/agents/base.py index c1e55a7542..18fb7a0051 100644 --- a/core/agents/base.py +++ b/core/agents/base.py @@ -77,6 +77,7 @@ class BaseAgent: allow_empty: bool = False, full_screen: Optional[bool] = False, hint: Optional[str] = None, + verbose: bool = True, initial_text: Optional[str] = None, extra_info: Optional[str] = None, ) -> UserInput: @@ -106,6 +107,7 @@ class BaseAgent: allow_empty=allow_empty, full_screen=full_screen, hint=hint, + verbose=verbose, initial_text=initial_text, source=self.ui_source, project_state_id=str(self.current_state.id), diff --git a/core/agents/spec_writer.py b/core/agents/spec_writer.py index 2646f5dc2d..387f224a05 100644 --- a/core/agents/spec_writer.py +++ b/core/agents/spec_writer.py @@ -155,6 +155,7 @@ class SpecWriter(BaseAgent): user_response = await self.ask_question( response, buttons={"skip": "Skip this question", "skip_all": "No more questions"}, + verbose=False, ) if user_response.cancelled or user_response.button == "skip_all": convo.user( diff --git a/core/ui/base.py b/core/ui/base.py index d3489941d1..cd888c1914 100644 --- a/core/ui/base.py +++ b/core/ui/base.py @@ -172,6 +172,7 @@ class UIBase: allow_empty: bool = False, full_screen: Optional[bool] = False, hint: Optional[str] = None, + verbose: bool = True, initial_text: Optional[str] = None, source: Optional[UISource] = None, project_state_id: Optional[str] = None, diff --git a/core/ui/console.py b/core/ui/console.py index f969e840af..22479d1c04 100644 --- a/core/ui/console.py +++ b/core/ui/console.py @@ -72,6 +72,7 @@ class PlainConsoleUI(UIBase): allow_empty: bool = False, full_screen: Optional[bool] = False, hint: Optional[str] = None, + verbose: bool = True, initial_text: Optional[str] = None, source: Optional[UISource] = None, project_state_id: Optional[str] = None, diff --git a/core/ui/ipc_client.py b/core/ui/ipc_client.py index fcd852c07f..661292ab80 100644 --- a/core/ui/ipc_client.py +++ b/core/ui/ipc_client.py @@ -264,6 +264,7 @@ class IPCClientUI(UIBase): allow_empty: bool = False, full_screen: Optional[bool] = False, hint: Optional[str] = None, + verbose: bool = True, initial_text: Optional[str] = None, source: Optional[UISource] = None, project_state_id: Optional[str] = None, @@ -282,7 +283,7 @@ class IPCClientUI(UIBase): project_state_id=project_state_id, extra_info=extra_info, ) - else: + elif verbose: await self._send( MessageType.VERBOSE, content=question, diff --git a/core/ui/virtual.py b/core/ui/virtual.py index fbb5dcb3ff..4aed56c0ed 100644 --- a/core/ui/virtual.py +++ b/core/ui/virtual.py @@ -72,6 +72,7 @@ class VirtualUI(UIBase): allow_empty: bool = False, full_screen: Optional[bool] = False, hint: Optional[str] = None, + verbose: bool = True, initial_text: Optional[str] = None, source: Optional[UISource] = None, project_state_id: Optional[str] = None, diff --git a/tests/agents/test_base.py b/tests/agents/test_base.py index 94bb367838..c60343e889 100644 --- a/tests/agents/test_base.py +++ b/tests/agents/test_base.py @@ -53,6 +53,7 @@ async def test_ask_question(): default=None, allow_empty=False, hint=None, + verbose=True, initial_text=None, source=agent.ui_source, project_state_id=str(agent.current_state.id),