(self, goal: str)
| 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""" |
no test coverage detected