PYAE1994 commited on
Commit
b99d24e
·
verified ·
1 Parent(s): 218457b

God Mode+ v3 fix: agents/chat_agent.py

Browse files
Files changed (1) hide show
  1. agents/chat_agent.py +21 -30
agents/chat_agent.py CHANGED
@@ -1,18 +1,15 @@
1
  """
2
- ChatAgent — Conversational interface with streaming, Burmese support
3
  """
4
- from typing import Dict
5
  import structlog
 
6
  from .base_agent import BaseAgent
7
 
8
  log = structlog.get_logger()
9
 
10
- CHAT_SYSTEM = """You are God Agent — an elite autonomous AI operating system.
11
- You support both English and Burmese (မြန်မာဘာသာ) languages.
12
- Be helpful, precise, and autonomous.
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 = kwargs.get("task_id", "")
25
-
26
- history = context.get("history", [])
27
- messages = [{"role": "system", "content": CHAT_SYSTEM}]
28
-
29
- for h in history[-10:]:
30
- messages.append({"role": h.get("role", "user"), "content": h.get("content", "")})
31
-
32
- messages.append({"role": "user", "content": task})
33
-
34
- await self.emit_chat(session_id, "stream_start", {"agent": "ChatAgent", "status": "generating"})
35
-
36
- response = await self.llm(messages, task_id=task_id, session_id=session_id)
37
-
38
- await self.emit_chat(session_id, "stream_end", {
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