Set default working directory for OpenCode to ~/Workspace
This commit is contained in:
@@ -508,6 +508,7 @@ def build_llm(args: argparse.Namespace, vocabulary=None, brain=None, observer=No
|
|||||||
system_prompt += "\n\n" + memory
|
system_prompt += "\n\n" + memory
|
||||||
return OpenCodeLLM(
|
return OpenCodeLLM(
|
||||||
model=args.opencode_model,
|
model=args.opencode_model,
|
||||||
|
cwd=args.cwd,
|
||||||
system_prompt=system_prompt,
|
system_prompt=system_prompt,
|
||||||
observer=observer,
|
observer=observer,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -79,12 +79,14 @@ class OpenCodeLLM(FrameProcessor):
|
|||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
model: str = "ollama-cloud/gemma4:31b",
|
model: str = "ollama-cloud/gemma4:31b",
|
||||||
|
cwd: str | Path | None = None,
|
||||||
system_prompt: str | None = None,
|
system_prompt: str | None = None,
|
||||||
observer=None,
|
observer=None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self._model = model
|
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._system_prompt = system_prompt or "You are a helpful spoken voice assistant. Keep answers brief and conversational."
|
||||||
self._on_reply = observer
|
self._on_reply = observer
|
||||||
self._turn_task: asyncio.Task | None = None
|
self._turn_task: asyncio.Task | None = None
|
||||||
@@ -157,11 +159,13 @@ class OpenCodeLLM(FrameProcessor):
|
|||||||
self._cli_path,
|
self._cli_path,
|
||||||
"run",
|
"run",
|
||||||
"-m", self._model,
|
"-m", self._model,
|
||||||
|
"--dir", str(self._cwd),
|
||||||
"--pure",
|
"--pure",
|
||||||
prompt_str,
|
prompt_str,
|
||||||
stdout=asyncio.subprocess.PIPE,
|
stdout=asyncio.subprocess.PIPE,
|
||||||
stderr=asyncio.subprocess.PIPE,
|
stderr=asyncio.subprocess.PIPE,
|
||||||
stdin=asyncio.subprocess.DEVNULL,
|
stdin=asyncio.subprocess.DEVNULL,
|
||||||
|
cwd=str(self._cwd),
|
||||||
)
|
)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
Reference in New Issue
Block a user