Spaces:
Sleeping
Sleeping
Update backend.py
Browse files- backend.py +20 -21
backend.py
CHANGED
|
@@ -87,34 +87,33 @@ ROLE_PROMPTS = {
|
|
| 87 |
Analyze the user's request and provide a list of files to be created.
|
| 88 |
Then, create the very first task for the Manager to execute.
|
| 89 |
Respond ONLY with a JSON object with keys "plan" and "initial_task".
|
| 90 |
-
Example: {"plan": {"files": ["app.py", "backend.py"]}, "initial_task": "
|
| 91 |
|
| 92 |
-
"manager": """You are the Manager. You receive tasks and questions. Your job is to
|
| 93 |
-
1.
|
| 94 |
-
2.
|
| 95 |
-
3.
|
| 96 |
-
4.
|
| 97 |
-
|
| 98 |
Respond ONLY with a JSON object with "action" and "data".
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
| 101 |
"worker_coder": """You are a Coder. Your only job is to write code based on the Manager's task.
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
3. "ask_manager": If you are stuck, need clarification, or the task is unclear.
|
| 106 |
-
4. "task_complete": When you have successfully finished the assigned task.
|
| 107 |
Respond ONLY with a JSON object with "action" and "data".
|
| 108 |
Example: {"action": "write_code", "data": {"file_path": "backend.py", "code": "import sqlite3..."}}""",
|
| 109 |
|
| 110 |
-
"worker_tester": """You are a Tester. Your only job is to write tests
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
3. "ask_manager": If you need clarification on what to test.
|
| 115 |
-
4. "task_complete": When you have finished writing the tests.
|
| 116 |
Respond ONLY with a JSON object with "action" and "data".
|
| 117 |
-
Example: {"action": "write_test", "data": {"file_path": "tests/test_backend.py", "code": "import pytest..."}}"""
|
| 118 |
}
|
| 119 |
|
| 120 |
# ------------------------------ FILE SYSTEM & AI TOOLS ------------------------------
|
|
|
|
| 87 |
Analyze the user's request and provide a list of files to be created.
|
| 88 |
Then, create the very first task for the Manager to execute.
|
| 89 |
Respond ONLY with a JSON object with keys "plan" and "initial_task".
|
| 90 |
+
Example: {"plan": {"files": ["app.py", "backend.py", "tests/test_app.py"]}, "initial_task": "Start by writing the backend.py file with database functions."}""",
|
| 91 |
|
| 92 |
+
"manager": """You are the Manager. You receive tasks and questions. Your job is to:
|
| 93 |
+
1. Break down work into small steps for workers
|
| 94 |
+
2. After a worker completes a task, assign the NEXT logical task (code another file OR write tests)
|
| 95 |
+
3. Only finish when ALL code and tests are complete
|
| 96 |
+
4. If unsure, ask the CEO
|
| 97 |
+
Available actions: "delegate_to_worker", "answer_worker", "ask_ceo", "finish_project"
|
| 98 |
Respond ONLY with a JSON object with "action" and "data".
|
| 99 |
+
Examples:
|
| 100 |
+
- {"action": "delegate_to_worker", "data": {"worker_type": "coder", "task": "Write the full Python code for app.py"}}
|
| 101 |
+
- {"action": "delegate_to_worker", "data": {"worker_type": "tester", "task": "Write unit tests for backend.py"}}
|
| 102 |
+
- {"action": "finish_project", "data": {}}""",
|
| 103 |
+
|
| 104 |
"worker_coder": """You are a Coder. Your only job is to write code based on the Manager's task.
|
| 105 |
+
After completing a task, report "task_complete" - DO NOT decide what to do next.
|
| 106 |
+
The Manager will assign the next file to code.
|
| 107 |
+
Available actions: "write_code", "read_file", "ask_manager", "task_complete"
|
|
|
|
|
|
|
| 108 |
Respond ONLY with a JSON object with "action" and "data".
|
| 109 |
Example: {"action": "write_code", "data": {"file_path": "backend.py", "code": "import sqlite3..."}}""",
|
| 110 |
|
| 111 |
+
"worker_tester": """You are a Tester. Your only job is to write tests for existing code.
|
| 112 |
+
After completing test writing, report "task_complete".
|
| 113 |
+
The Manager will decide if more tests are needed or if the project can finish.
|
| 114 |
+
Available actions: "write_test", "read_file", "ask_manager", "task_complete"
|
|
|
|
|
|
|
| 115 |
Respond ONLY with a JSON object with "action" and "data".
|
| 116 |
+
Example: {"action": "write_test", "data": {"file_path": "tests/test_backend.py", "code": "import pytest..."}}"""
|
| 117 |
}
|
| 118 |
|
| 119 |
# ------------------------------ FILE SYSTEM & AI TOOLS ------------------------------
|