turn request_task_implementation return val into a string and add prompt to fix duplicated work.
This commit is contained in:
parent
8760e6e152
commit
d6bcf44700
|
|
@ -237,7 +237,7 @@ def request_research_and_implementation(query: str) -> Dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
@tool("request_task_implementation")
|
@tool("request_task_implementation")
|
||||||
def request_task_implementation(task_spec: str) -> Dict[str, Any]:
|
def request_task_implementation(task_spec: str) -> str:
|
||||||
"""Spawn an implementation agent to execute the given task.
|
"""Spawn an implementation agent to execute the given task.
|
||||||
|
|
||||||
Task specs should have the requirements. Generally, the spec will not include any code.
|
Task specs should have the requirements. Generally, the spec will not include any code.
|
||||||
|
|
@ -311,7 +311,42 @@ def request_task_implementation(task_spec: str) -> Dict[str, Any]:
|
||||||
}
|
}
|
||||||
if work_log is not None:
|
if work_log is not None:
|
||||||
response_data["work_log"] = work_log
|
response_data["work_log"] = work_log
|
||||||
return response_data
|
|
||||||
|
# Convert the response data to a markdown string
|
||||||
|
markdown_parts = []
|
||||||
|
|
||||||
|
# Add header and completion message
|
||||||
|
markdown_parts.append("# Task Implementation")
|
||||||
|
if response_data.get("completion_message"):
|
||||||
|
markdown_parts.append(f"\n## Completion Message\n\n{response_data['completion_message']}")
|
||||||
|
|
||||||
|
# Add success status
|
||||||
|
status = "Success" if response_data.get("success", False) else "Failed"
|
||||||
|
reason_text = f": {response_data.get('reason')}" if response_data.get("reason") else ""
|
||||||
|
markdown_parts.append(f"\n## Status\n\n**{status}**{reason_text}")
|
||||||
|
|
||||||
|
# Add key facts
|
||||||
|
if response_data.get("key_facts"):
|
||||||
|
markdown_parts.append(f"\n## Key Facts\n\n{response_data['key_facts']}")
|
||||||
|
|
||||||
|
# Add related files
|
||||||
|
if response_data.get("related_files"):
|
||||||
|
files_list = "\n".join([f"- {file}" for file in response_data["related_files"]])
|
||||||
|
markdown_parts.append(f"\n## Related Files\n\n{files_list}")
|
||||||
|
|
||||||
|
# Add key snippets
|
||||||
|
if response_data.get("key_snippets"):
|
||||||
|
markdown_parts.append(f"\n## Key Snippets\n\n{response_data['key_snippets']}")
|
||||||
|
|
||||||
|
# Add work log
|
||||||
|
if response_data.get("work_log"):
|
||||||
|
markdown_parts.append(f"\n## Work Log\n\n{response_data['work_log']}")
|
||||||
|
markdown_parts.append(f"\n\nTHE ABOVE WORK HAS ALREADY BEEN COMPLETED --**DO NOT REQUEST IMPLEMENTATION OF IT AGAIN**")
|
||||||
|
|
||||||
|
# Join all parts into a single markdown string
|
||||||
|
markdown_output = "".join(markdown_parts)
|
||||||
|
|
||||||
|
return markdown_output
|
||||||
|
|
||||||
|
|
||||||
@tool("request_implementation")
|
@tool("request_implementation")
|
||||||
|
|
@ -406,7 +441,7 @@ def request_implementation(task_spec: str) -> str:
|
||||||
# Add work log
|
# Add work log
|
||||||
if response_data.get("work_log"):
|
if response_data.get("work_log"):
|
||||||
markdown_parts.append(f"\n## Work Log\n\n{response_data['work_log']}")
|
markdown_parts.append(f"\n## Work Log\n\n{response_data['work_log']}")
|
||||||
markdown_parts.append(f"\n\nTHE ABOVE WORK HAS ALREADY BEEN COMPLETED --**DO NOT DO THIS WORK AGAIN**")
|
markdown_parts.append(f"\n\nTHE ABOVE WORK HAS ALREADY BEEN COMPLETED --**DO NOT REQUEST IMPLEMENTATION OF IT AGAIN**")
|
||||||
|
|
||||||
# Join all parts into a single markdown string
|
# Join all parts into a single markdown string
|
||||||
markdown_output = "".join(markdown_parts)
|
markdown_output = "".join(markdown_parts)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue