Added new feature request in deep focus pipeline

pull/1160/head
matija-ilijas 2 years ago
parent 19c472c9ab
commit ea3e8b7d9b

@ -182,8 +182,6 @@ class Orchestrator(BaseAgent):
return Importer(self.state_manager, self.ui, prev_response=prev_response)
if prev_response.type == ResponseType.EXTERNAL_DOCS_REQUIRED:
return ExternalDocumentation(self.state_manager, self.ui, prev_response=prev_response)
if prev_response.type == ResponseType.NEW_FEATURE_REQUESTED:
return SpecWriter(self.state_manager, self.ui, prev_response=prev_response)
if not state.specification.description:
if state.files:
# The project has been imported, but not analyzed yet
@ -253,6 +251,9 @@ class Orchestrator(BaseAgent):
elif current_iteration_status == IterationStatus.PROBLEM_SOLVER:
# Call Problem Solver if the user said "I'm stuck in a loop"
return ProblemSolver(self.state_manager, self.ui)
elif current_iteration_status == IterationStatus.NEW_FEATURE_REQUESTED:
# Call Spec Writer to add the "change" requested by the user to project specification
return SpecWriter(self.state_manager, self.ui)
# We have just finished the task, call Troubleshooter to ask the user to review
return Troubleshooter(self.state_manager, self.ui)

@ -45,9 +45,6 @@ class ResponseType(str, Enum):
EXTERNAL_DOCS_REQUIRED = "external-docs-required"
"""We need to fetch external docs for a task."""
NEW_FEATURE_REQUESTED = "new-feature-requested"
"""User wants to add a new feature to project specification."""
class AgentResponse:
type: ResponseType = ResponseType.DONE

@ -1,6 +1,7 @@
from core.agents.base import BaseAgent
from core.agents.convo import AgentConvo
from core.agents.response import AgentResponse, ResponseType
from core.agents.response import AgentResponse
from core.db.models.project_state import IterationStatus
from core.db.models import Complexity
from core.llm.parser import StringParser
from core.log import get_logger
@ -26,7 +27,8 @@ class SpecWriter(BaseAgent):
display_name = "Spec Writer"
async def run(self) -> AgentResponse:
if self.prev_response and self.prev_response.type == ResponseType.NEW_FEATURE_REQUESTED:
current_iteration = self.current_state.current_iteration
if current_iteration is not None and current_iteration["status"] == IterationStatus.NEW_FEATURE_REQUESTED:
return await self.update_spec()
else:
return await self.initialize_spec()
@ -79,25 +81,10 @@ class SpecWriter(BaseAgent):
telemetry.set("is_complex_app", complexity != Complexity.SIMPLE)
self.next_state.action = SPEC_STEP_NAME
return AgentResponse.new_feature_requested(self)
return AgentResponse.done(self)
async def update_spec(self) -> AgentResponse:
response = await self.ask_question(
"Describe the new feature you want to add",
allow_empty=False,
buttons={
# FIXME: must be lowercase becase VSCode doesn't recognize it otherwise. Needs a fix in the extension
"cancel": "cancel",
},
)
if response.cancelled:
return AgentResponse.error(self, "No feature description")
if response.button == "cancel":
return AgentResponse.error(self, "No feature description")
feature_description = response.text.strip()
feature_description = self.current_state.current_iteration["description"]
await self.send_message("Adding new feature to project specification ...")
llm = self.get_llm()
convo = AgentConvo(self).template("add_new_feature", feature_description=feature_description)
@ -111,7 +98,8 @@ class SpecWriter(BaseAgent):
"initial_prompt", updated_spec
) # TODO Check if a separate telemetry variable needed for updated spec
self.next_state.action = SPEC_STEP_NAME
self.next_state.current_iteration["status"] = IterationStatus.FIND_SOLUTION
self.next_state.flag_iterations_as_modified()
return AgentResponse.done(self)
async def check_prompt_complexity(self, prompt: str) -> str:

@ -87,7 +87,7 @@ class Troubleshooter(IterationPromptMixin, BaseAgent):
return await self.complete_task()
user_feedback = bug_report or change_description
user_feedback_qa = await self.generate_bug_report(run_command, user_instructions, user_feedback)
user_feedback_qa = None # await self.generate_bug_report(run_command, user_instructions, user_feedback)
if is_loop:
if last_iteration["alternative_solutions"]:
@ -102,7 +102,7 @@ class Troubleshooter(IterationPromptMixin, BaseAgent):
else:
# should be - elif change_description is not None: - but to prevent bugs with the extension
# this might be caused if we show the input field instead of buttons
iteration_status = IterationStatus.FIND_SOLUTION
iteration_status = IterationStatus.NEW_FEATURE_REQUESTED
self.next_state.iterations = self.current_state.iterations + [
{

@ -41,6 +41,7 @@ class IterationStatus:
IMPLEMENT_SOLUTION = "implement_solution"
FIND_SOLUTION = "find_solution"
PROBLEM_SOLVER = "problem_solver"
NEW_FEATURE_REQUESTED = "new_feature_requested"
DONE = "done"

Loading…
Cancel
Save