God Mode+ v3 fix: agents/chat_agent.py
Browse files- agents/chat_agent.py +21 -30
agents/chat_agent.py
CHANGED
|
@@ -1,18 +1,15 @@
|
|
| 1 |
"""
|
| 2 |
-
ChatAgent — Conversational
|
| 3 |
"""
|
| 4 |
-
from typing import Dict
|
| 5 |
import structlog
|
|
|
|
| 6 |
from .base_agent import BaseAgent
|
| 7 |
|
| 8 |
log = structlog.get_logger()
|
| 9 |
|
| 10 |
-
|
| 11 |
-
You
|
| 12 |
-
Be
|
| 13 |
-
When users write in Burmese, respond in Burmese.
|
| 14 |
-
When discussing code, provide production-quality examples.
|
| 15 |
-
"""
|
| 16 |
|
| 17 |
|
| 18 |
class ChatAgent(BaseAgent):
|
|
@@ -20,25 +17,19 @@ class ChatAgent(BaseAgent):
|
|
| 20 |
super().__init__("ChatAgent", ws_manager, ai_router)
|
| 21 |
|
| 22 |
async def run(self, task: str, context: Dict = {}, **kwargs) -> str:
|
| 23 |
-
session_id = kwargs.get("session_id", "")
|
| 24 |
-
task_id
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
"agent": "ChatAgent",
|
| 40 |
-
"full_response": response,
|
| 41 |
-
"status": "complete",
|
| 42 |
-
})
|
| 43 |
-
|
| 44 |
-
return response
|
|
|
|
| 1 |
"""
|
| 2 |
+
ChatAgent — Conversational AI via LLMRouter
|
| 3 |
"""
|
|
|
|
| 4 |
import structlog
|
| 5 |
+
from typing import Dict
|
| 6 |
from .base_agent import BaseAgent
|
| 7 |
|
| 8 |
log = structlog.get_logger()
|
| 9 |
|
| 10 |
+
SYSTEM_PROMPT = """You are God Mode+ AI — an elite autonomous AI software engineer (Devin + Manus style).
|
| 11 |
+
You can plan, code, debug, refactor, test, and deploy software autonomously.
|
| 12 |
+
Be concise, helpful, and professional. Use markdown formatting."""
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
class ChatAgent(BaseAgent):
|
|
|
|
| 17 |
super().__init__("ChatAgent", ws_manager, ai_router)
|
| 18 |
|
| 19 |
async def run(self, task: str, context: Dict = {}, **kwargs) -> str:
|
| 20 |
+
session_id = kwargs.get("session_id", context.get("session_id", ""))
|
| 21 |
+
task_id = kwargs.get("task_id", context.get("task_id", ""))
|
| 22 |
+
|
| 23 |
+
messages = [
|
| 24 |
+
{"role": "system", "content": SYSTEM_PROMPT},
|
| 25 |
+
{"role": "user", "content": task},
|
| 26 |
+
]
|
| 27 |
+
|
| 28 |
+
await self.emit(task_id, "agent_thinking", {"agent": "chat", "message": task[:100]}, session_id)
|
| 29 |
+
|
| 30 |
+
result = await self.ask_llm(
|
| 31 |
+
messages=messages,
|
| 32 |
+
task_id=task_id,
|
| 33 |
+
session_id=session_id,
|
| 34 |
+
)
|
| 35 |
+
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|