diff --git a/examples/ui_role.py b/examples/ui_role.py index 453911a7d..101be9c69 100644 --- a/examples/ui_role.py +++ b/examples/ui_role.py @@ -217,7 +217,7 @@ class UIDesign(Action): logger.info("Finish icon design using StableDiffusion API") async def _save(self, css_content, html_content): - save_dir = WORKSPACE_ROOT / "UI" / 'docs/' + save_dir = WORKSPACE_ROOT / "resources" / 'codes' if not os.path.exists(save_dir): os.makedirs(save_dir, exist_ok=True) # Save CSS and HTML content to files diff --git a/metagpt/actions/action.py b/metagpt/actions/action.py index 29c10d827..905b044df 100644 --- a/metagpt/actions/action.py +++ b/metagpt/actions/action.py @@ -55,10 +55,10 @@ class Action(ABC): system_msgs = [] system_msgs.append(self.prefix) content = await self.llm.aask(prompt, system_msgs) - logger.info(content) + logger.debug(content) output_class = ActionOutput.create_model_class(output_class_name, output_data_mapping) parsed_data = OutputParser.parse_data_with_mapping(content, output_data_mapping) - logger.info(parsed_data) + logger.debug(parsed_data) instruct_content = output_class(**parsed_data) return ActionOutput(content, instruct_content) diff --git a/metagpt/actions/write_prd.py b/metagpt/actions/write_prd.py index aa469bd5d..957566aab 100644 --- a/metagpt/actions/write_prd.py +++ b/metagpt/actions/write_prd.py @@ -132,7 +132,8 @@ class WritePRD(Action): async def run(self, requirements, *args, **kwargs) -> ActionOutput: sas = SearchAndSummarize() - rsp = await sas.run(context=requirements, system_text=SEARCH_AND_SUMMARIZE_SYSTEM_EN_US) + # rsp = await sas.run(context=requirements, system_text=SEARCH_AND_SUMMARIZE_SYSTEM_EN_US) + rsp = "" info = f"### Search Results\n{sas.result}\n\n### Search Summary\n{rsp}" if sas.result: logger.info(sas.result) @@ -140,6 +141,6 @@ class WritePRD(Action): prompt = PROMPT_TEMPLATE.format(requirements=requirements, search_information=info, format_example=FORMAT_EXAMPLE) - logger.info(prompt) + logger.debug(prompt) prd = await self._aask_v1(prompt, "prd", OUTPUT_MAPPING) return prd diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 4ddb84252..de3bb3369 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -114,7 +114,7 @@ class Role: def _set_state(self, state): """Update the current state.""" self._rc.state = state - logger.info(self._actions) + logger.debug(self._actions) self._rc.todo = self._actions[self._rc.state] def set_env(self, env: 'Environment'): diff --git a/metagpt/tools/sd_engine.py b/metagpt/tools/sd_engine.py index 13d51353e..8f7df68fe 100644 --- a/metagpt/tools/sd_engine.py +++ b/metagpt/tools/sd_engine.py @@ -79,7 +79,7 @@ class SDEngine: def _save(self, imgs, save_name=""): # fixme:寻址 - save_dir = WORKSPACE_ROOT / "SD_Output" + save_dir = WORKSPACE_ROOT / "resources"/"SD_Output" if not os.path.exists(save_dir): os.makedirs(save_dir, exist_ok=True) batch_decode_base64_to_image(imgs, save_dir, save_name=save_name) diff --git a/tests/metagpt/test_ui_design.py b/tests/metagpt/actions/test_ui_design.py similarity index 62% rename from tests/metagpt/test_ui_design.py rename to tests/metagpt/actions/test_ui_design.py index 304241a6c..e01b90477 100644 --- a/tests/metagpt/test_ui_design.py +++ b/tests/metagpt/actions/test_ui_design.py @@ -4,9 +4,7 @@ # from examples.ui_role import UIDesign -def test_ui_design_parse_css(): - ui_design_work = UIDesign(name="UI design action") - llm_resp = ''' +llm_resp= ''' # UI Design Description ```The user interface for the snake game will be designed in a way that is simple, clean, and intuitive. The main elements of the game such as the game grid, snake, food, score, and game over message will be clearly defined and easy to understand. The game grid will be centered on the screen with the score displayed at the top. The game controls will be intuitive and easy to use. The design will be modern and minimalist with a pleasing color scheme.``` @@ -102,6 +100,9 @@ body { font-size: 3em; ''' +def test_ui_design_parse_css(): + ui_design_work = UIDesign(name="UI design action") + css = ''' body { display: flex; @@ -165,101 +166,6 @@ body { def test_ui_design_parse_html(): ui_design_work = UIDesign(name="UI design action") - llm_resp = ''' - # UI Design Description -```The user interface for the snake game will be designed in a way that is simple, clean, and intuitive. The main elements of the game such as the game grid, snake, food, score, and game over message will be clearly defined and easy to understand. The game grid will be centered on the screen with the score displayed at the top. The game controls will be intuitive and easy to use. The design will be modern and minimalist with a pleasing color scheme.``` - -## Selected Elements - -Game Grid: The game grid will be a rectangular area in the center of the screen where the game will take place. It will be defined by a border and will have a darker background color. - -Snake: The snake will be represented by a series of connected blocks that move across the grid. The color of the snake will be different from the background color to make it stand out. - -Food: The food will be represented by small objects that are a different color from the snake and the background. The food will be randomly placed on the grid. - -Score: The score will be displayed at the top of the screen. The score will increase each time the snake eats a piece of food. - -Game Over: When the game is over, a message will be displayed in the center of the screen. The player will be given the option to restart the game. - -## HTML Layout -```html - - -
- - -