use "continue" label for continue buttons; fix project template message

pull/1160/head
Senko Rasic 3 years ago
parent 008675f3c2
commit 2b7d018cd0

@ -55,9 +55,7 @@ class TaskSteps(BaseModel):
class RelevantFiles(BaseModel):
relevant_files: list[str] = Field(
description="List of relevant files for the current task."
)
relevant_files: list[str] = Field(description="List of relevant files for the current task.")
class Developer(BaseAgent):
@ -206,20 +204,22 @@ class Developer(BaseAgent):
return AgentResponse.done(self)
async def get_relevant_files(
self,
user_feedback: Optional[str] = None,
solution_description: Optional[str] = None
self, user_feedback: Optional[str] = None, solution_description: Optional[str] = None
) -> AgentResponse:
log.debug("Getting relevant files for the current task")
await self.send_message("Figuring out which project files are relevant for the next task ...")
llm = self.get_llm()
convo = AgentConvo(self).template(
"filter_files",
current_task=self.current_state.current_task,
user_feedback=user_feedback,
solution_description=solution_description,
).require_schema(RelevantFiles)
convo = (
AgentConvo(self)
.template(
"filter_files",
current_task=self.current_state.current_task,
user_feedback=user_feedback,
solution_description=solution_description,
)
.require_schema(RelevantFiles)
)
llm_response: list[str] = await llm(convo, parser=JSONParser(RelevantFiles), temperature=0)
@ -290,9 +290,8 @@ class Developer(BaseAgent):
user_response = await self.ask_question(
"Edit the task description:",
buttons={
# FIXME: Continue doesn't actually work, VSCode doesn't send the user
# message if it's clicked. Long term we need to fix the extension.
# "continue": "Continue",
# FIXME: must be lowercase becase VSCode doesn't recognize it otherwise. Needs a fix in the extension
"continue": "continue",
"cancel": "Cancel",
},
default="continue",

@ -26,7 +26,11 @@ class SpecWriter(BaseAgent):
response = await self.ask_question(
"Describe your app in as much detail as possible",
allow_empty=False,
buttons={"example": "Start an example project"},
buttons={
# FIXME: must be lowercase becase VSCode doesn't recognize it otherwise. Needs a fix in the extension
"continue": "continue",
"example": "Start an example project",
},
)
if response.cancelled:
return AgentResponse.error(self, "No project description")
@ -34,6 +38,10 @@ class SpecWriter(BaseAgent):
if response.button == "example":
self.prepare_example_project()
return AgentResponse.done(self)
elif response.button == "continue":
# FIXME: Workaround for the fact that VSCode "continue" button does
# nothing but repeat the question. We reproduce this bug for bug here.
return AgentResponse.done(self)
spec = response.text

@ -9,7 +9,7 @@ from core.agents.response import AgentResponse, ResponseType
from core.db.models import Complexity
from core.llm.parser import JSONParser
from core.log import get_logger
from core.templates.registry import apply_project_template, get_template_summary
from core.templates.registry import apply_project_template, get_template_description, get_template_summary
from core.ui.base import ProjectStage
log = get_logger(__name__)
@ -76,8 +76,9 @@ class TechLead(BaseAgent):
if len(state.epics) != 1 or not state.specification.template:
return None
log.info(f"Applying project template: {self.current_state.specification.template}")
await self.send_message(f"Applying project template {self.current_state.specification.template} ...")
description = get_template_description(state.specification.template)
log.info(f"Applying project template: {state.specification.template}")
await self.send_message(f"Applying project template {description} ...")
summary = await apply_project_template(
self.current_state.specification.template,
self.state_manager,
@ -92,11 +93,11 @@ class TechLead(BaseAgent):
log.debug("Asking for new feature")
response = await self.ask_question(
"Do you have a new feature to add to the project? Just write it here",
buttons={"end": "No, I'm done"},
buttons={"continue": "continue", "end": "No, I'm done"},
allow_empty=True,
)
if response.cancelled or response.button == "end" or not response.text:
if response.cancelled or not response.text:
return AgentResponse.exit(self)
self.next_state.epics = self.current_state.epics + [

@ -175,9 +175,9 @@ class Troubleshooter(IterationPromptMixin, BaseAgent):
if run_command:
await self.ui.send_run_command(run_command)
buttons = {"continue": "Everything works, continue"}
buttons = {"continue": "continue"}
if last_iteration:
buttons["loop"] = "I still have the same issue"
buttons["loop"] = "I'm stuck in a loop"
user_response = await self.ask_question(
test_message,

@ -66,7 +66,7 @@ async def start_new_project(sm: StateManager, ui: UIBase) -> bool:
:param ui: User interface.
:return: True if the project was created successfully, False otherwise.
"""
user_input = await ui.ask_question("What is the name of the project", allow_empty=False, source=pythagora_source)
user_input = await ui.ask_question("What is the project name?", allow_empty=False, source=pythagora_source)
if user_input.cancelled:
return False

@ -92,3 +92,17 @@ def get_template_summary(template_name: str) -> Optional[str]:
return None
template = PROJECT_TEMPLATES[template_name]
return template["summary"]
def get_template_description(template_name: str) -> Optional[str]:
"""
Get the description of a project template.
:param template_name: The name of the project template.
:return: A summary of the template, or None if no template was found.
"""
if not template_name or template_name not in PROJECT_TEMPLATES:
log.warning(f"Project template '{template_name}' not found, ignoring")
return None
template = PROJECT_TEMPLATES[template_name]
return template["description"]

Loading…
Cancel
Save