Skip to content

Commit

Permalink
Added support for user's written feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Zvonimir Sabljic committed Aug 10, 2024
1 parent 5e87a47 commit 3d60760
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
22 changes: 16 additions & 6 deletions core/agents/bug_hunter.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ async def check_logs(self, logs_message: str = None):
for hunting_cycle in self.current_state.current_iteration.get("bug_hunting_cycles", []):
convo = convo.assistant(hunting_cycle["human_readable_instructions"]).template(
"log_data",
backend_logs=hunting_cycle["backend_logs"],
frontend_logs=hunting_cycle["frontend_logs"],
fix_attempted=hunting_cycle["fix_attempted"],
backend_logs=hunting_cycle.get("backend_logs"),
frontend_logs=hunting_cycle.get("frontend_logs"),
fix_attempted=hunting_cycle.get("fix_attempted"),
user_feedback=hunting_cycle.get("user_feedback"),
)

human_readable_instructions = await llm(convo, temperature=0.5)
Expand Down Expand Up @@ -161,12 +162,21 @@ async def ask_user_to_test(self, awaiting_bug_reproduction: bool = False, awaiti
+ self.current_state.current_iteration["bug_reproduction_description"],
)

if frontend_logs.button == "done":
self.next_state.complete_iteration()
else:
user_feedback = await self.ask_question(
"Do you want to add anything else to help Pythagora solve this bug?",
buttons={"continue": "Continue", "done": "Bug is fixed"},
default="continue",
hint="Instructions for testing:\n\n"
+ self.current_state.current_iteration["bug_reproduction_description"],
)

# TODO select only the logs that are new (with PYTHAGORA_DEBUGGING_LOG)
self.next_state.current_iteration["bug_hunting_cycles"][-1]["backend_logs"] = backend_logs.text
self.next_state.current_iteration["bug_hunting_cycles"][-1]["frontend_logs"] = frontend_logs.text
self.next_state.current_iteration["bug_hunting_cycles"][-1]["user_feedback"] = user_feedback.text
self.next_state.current_iteration["status"] = IterationStatus.HUNTING_FOR_BUG

if frontend_logs.button == "done":
self.next_state.complete_iteration()

return AgentResponse.done(self)
8 changes: 7 additions & 1 deletion core/prompts/bug-hunter/log_data.prompt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ Here are the logs we added to the frontend:
```
{{ frontend_logs }}
```
{% endif %}{% if user_feedback is not none %}
Finally, here is a hint from a human who tested the app:
```
{{ user_feedback }}
```
When you're thinking about what to do next, take into the account human's feedback.
{% endif %}{% if fix_attempted %}
The problem wasn't solved with the last changes. You have 2 options - to tell me exactly where is the problem happening or to add more logs to better determine where is the problem. If you think we should add more logs around the code to better understand the problem, tell me code snippets in which we should add the logs. If you think you know where the issue is, don't add any new logs but explain what log print tell point you to the problem, what the problem is, what is the solution to this problem and how the solution will fix the problem. What is your answer? Make sure not to repeat mistakes from before that didn't work.
{% endif %}
{% if backend_logs is none and frontend_logs is none and fix_attempted == false %}Human didn't supply any data{% endif %}
{% if backend_logs is none and frontend_logs is none and user_feedback is none and fix_attempted == false %}Human didn't supply any data{% endif %}

0 comments on commit 3d60760

Please sign in to comment.