diff --git a/bot.py b/bot.py index a4ea075..c8935fc 100644 --- a/bot.py +++ b/bot.py @@ -508,6 +508,7 @@ def build_llm(args: argparse.Namespace, vocabulary=None, brain=None, observer=No system_prompt += "\n\n" + memory return OpenCodeLLM( model=args.opencode_model, + cwd=args.cwd, system_prompt=system_prompt, observer=observer, ) diff --git a/opencode_llm.py b/opencode_llm.py index 6aa0ccf..3eca5af 100644 --- a/opencode_llm.py +++ b/opencode_llm.py @@ -79,12 +79,14 @@ class OpenCodeLLM(FrameProcessor): self, *, model: str = "ollama-cloud/gemma4:31b", + cwd: str | Path | None = None, system_prompt: str | None = None, observer=None, **kwargs, ): super().__init__(**kwargs) self._model = model + self._cwd = Path(cwd or Path.home() / "Workspace").expanduser().resolve() self._system_prompt = system_prompt or "You are a helpful spoken voice assistant. Keep answers brief and conversational." self._on_reply = observer self._turn_task: asyncio.Task | None = None @@ -157,11 +159,13 @@ class OpenCodeLLM(FrameProcessor): self._cli_path, "run", "-m", self._model, + "--dir", str(self._cwd), "--pure", prompt_str, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, stdin=asyncio.subprocess.DEVNULL, + cwd=str(self._cwd), ) while True: