MCPcopy Create free account
hub / github.com/RawdogReverend/TermNet / chat

Method chat

backend/termnet/agent.py:254–268  ·  view source on GitHub ↗
(self, goal: str)

Source from the content-addressed store, hash-verified

252 # MAIN CHAT LOOP
253 # -----------------------------
254 async def chat(self, goal: str):
255 self.last_activity = time.time()
256 self.current_goal = goal
257
258 # ✅ Always refresh system prompt before sending to LLM
259 self.conversation_history[0]["content"] = self._get_system_prompt()
260
261 self.conversation_history.append({"role": "user", "content": goal})
262 tools = self._get_tool_definitions()
263
264 # For LM Studio, we need to handle tool calling manually since it doesn't support function calling
265 if CONFIG.get("PROVIDER") == "lmstudio":
266 await self._handle_lmstudio_chat(tools)
267 else:
268 await self._handle_ollama_chat(tools)
269
270 async def _handle_lmstudio_chat(self, tools):
271 """Handle chat for LM Studio with OpenAI-style tool support"""

Callers 1

stream_agent_responseMethod · 0.80

Calls 4

_get_system_promptMethod · 0.95
_get_tool_definitionsMethod · 0.95
_handle_lmstudio_chatMethod · 0.95
_handle_ollama_chatMethod · 0.95

Tested by

no test coverage detected