From 0465e445ef4f32c1cd89f81bf5dc3a10c4f1575a Mon Sep 17 00:00:00 2001 From: LeonOstrez Date: Wed, 9 Aug 2023 13:53:21 +0200 Subject: [PATCH] fix prompts and loading of stored conversation --- euclid/helpers/Project.py | 2 +- euclid/helpers/agents/ProductOwner.py | 13 ++++++++----- euclid/prompts/high_level_questions/specs.prompt | 10 +++++----- euclid/prompts/user_stories/specs.prompt | 15 ++++++++++----- euclid/utils/questionary.py | 2 +- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/euclid/helpers/Project.py b/euclid/helpers/Project.py index 404ccd8..bac15e7 100644 --- a/euclid/helpers/Project.py +++ b/euclid/helpers/Project.py @@ -54,7 +54,7 @@ class Project: def start(self): self.project_manager = ProductOwner(self) - self.high_level_summary = self.project_manager.get_project_description() + self.project_manager.get_project_description() self.user_stories = self.project_manager.get_user_stories() self.user_tasks = self.project_manager.get_user_tasks() diff --git a/euclid/helpers/agents/ProductOwner.py b/euclid/helpers/agents/ProductOwner.py index ce1bfbe..27a69d2 100644 --- a/euclid/helpers/agents/ProductOwner.py +++ b/euclid/helpers/agents/ProductOwner.py @@ -24,8 +24,9 @@ class ProductOwner(Agent): step = get_progress_steps(self.project.args['app_id'], self.project.current_step) if step and not execute_step(self.project.args['step'], self.project.current_step): step_already_finished(self.project.args, step) - self.project_description = step['summary'] - return step['summary'] + self.project.project_description = step['summary'] + self.project.project_description_messages = step['messages'] + return # PROJECT DESCRIPTION self.project.args['app_type'] = ask_for_app_type() @@ -52,8 +53,9 @@ class ProductOwner(Agent): "app_data": generate_app_data(self.project.args) }) - self.project_description = high_level_summary - return high_level_summary + self.project.project_description = high_level_summary + self.project.project_description_messages = high_level_messages + return # PROJECT DESCRIPTION END @@ -75,7 +77,8 @@ class ProductOwner(Agent): self.project.user_stories = self.convo_user_stories.continuous_conversation('user_stories/specs.prompt', { 'name': self.project.args['name'], - 'prompt': self.project_description, + 'prompt': self.project.project_description, + 'clarifications': self.project.project_description_messages, 'app_type': self.project.args['app_type'], 'END_RESPONSE': END_RESPONSE }) diff --git a/euclid/prompts/high_level_questions/specs.prompt b/euclid/prompts/high_level_questions/specs.prompt index 443f370..b464e48 100644 --- a/euclid/prompts/high_level_questions/specs.prompt +++ b/euclid/prompts/high_level_questions/specs.prompt @@ -1,9 +1,9 @@ -I want you to create the application (let's call it "{{ name }}") that can be described like this: +I want you to create the {{ app_type }} (let's call it "{{ name }}") that can be described like this: ``` {{ prompt }} ``` -I'm going to show you an overview of tasks that you need to do to lead the process of creating this app and for each task, I will tell you an example of how would you solve this task for the example app. +I'm going to show you an overview of tasks that you need to do to lead the process of creating this {{ app_type }} and for each task, I will tell you an example of how would you solve this task for the example app. Example app description: `Create a script that finds Youtube channels with the word "test" inside the channel name`. Here is an overview of the tasks that you need to do: @@ -12,13 +12,13 @@ Here is an overview of the tasks that you need to do: - `do you want to enable user to be able to specify different word to search for in channel name?` - `do you want to save the results in a CSV file on the disk?` -2. Break down user stories. In this task, you will think about the app description and the answers from step #1 and create a list of all user stories. A user story is a description of how a user can interact with the app. In the example description, user stories could be: +2. Break down user stories. In this task, you will think about the {{ app_type }} description and the answers from step #1 and create a list of all user stories. A user story is a description of how a user can interact with the {{ app_type }}. In the example description, user stories could be: - `user will run the script from the CLI` - `user will get the list of all channels in a CSV file` -3. Break down user tasks. In this task, you will think about the app description, answers from step #1 and the user stories from the step #2 and create a list of user tasks that a user needs to do to interact with the app. In the example description, user tasks could be: +3. Break down user tasks. In this task, you will think about the {{ app_type }} description, answers from step #1 and the user stories from the step #2 and create a list of user tasks that a user needs to do to interact with the {{ app_type }}. In the example description, user tasks could be: - `user runs the CLI command in which they specify the keyword youtube channel needs to contain and the location where the CSV file will be saved to` -Let's start with the task #1 Getting additional answers. Think about the description for the app "{{ name }}" and ask questions that you would like to get cleared before going onto breaking down the user stories. +Let's start with the task #1 Getting additional answers. Think about the description for the {{ app_type }} "{{ name }}" and ask questions that you would like to get cleared before going onto breaking down the user stories. {{single_question}} diff --git a/euclid/prompts/user_stories/specs.prompt b/euclid/prompts/user_stories/specs.prompt index 1630998..03f82eb 100644 --- a/euclid/prompts/user_stories/specs.prompt +++ b/euclid/prompts/user_stories/specs.prompt @@ -3,15 +3,20 @@ I want you to create {{ app_type }} (let's call it "{{ name }}") that can be des {{ prompt }} ``` -Here are some additional questions and answers to clarify the apps description: +{% if clarifications and clarifications|length > 1 %} +Here are some additional questions and answers to clarify the {{ app_type }} description: ``` -{% for clarification in clarifications %} -Q: {{ clarification.question }} -A: {{ clarification.answer }} +{% for clarification in clarifications[2:] %} + {% if loop.index is odd %} + Q: {{ clarification.content }} + {% else %} + A: {{ clarification.content }} + {% endif %} {% endfor %} ``` +{% endif %} -Think step by step about the description for the app "{{ name }}" and the additional questions and answers and break down user stories. You will think about the app description and the answers listed and create a list of all user stories. A user story is a description of how a user can interact with the app. For example, if an app's description is `Create a script that finds Youtube channels with the word "test" inside the channel name`, user stories could be: +Think step by step about the description for the {{ app_type }} "{{ name }}" and the additional questions and answers and break down user stories. You will think about the {{ app_type }} description and the answers listed and create a list of all user stories. A user story is a description of how a user can interact with the {{ app_type }}. For example, if an app's description is `Create a script that finds Youtube channels with the word "test" inside the channel name`, user stories could be: - `user will run the script from the CLI` - `user will get the list of all channels in a CSV file` diff --git a/euclid/utils/questionary.py b/euclid/utils/questionary.py index efe845d..c60eeaf 100644 --- a/euclid/utils/questionary.py +++ b/euclid/utils/questionary.py @@ -21,7 +21,7 @@ def styled_select(*args, **kwargs): def styled_text(project, question): project.user_inputs_count += 1 user_input = get_user_input_from_hash_id(project, question) - if user_input is not None and project.skip_steps: + if user_input is not None and user_input.user_input is not None and project.skip_steps: # if we do, use it project.checkpoints['last_user_input'] = user_input print(colored(f'Restoring user input id {user_input.id}: ', 'yellow'), end='')