Integrate OpenCode CLI with ollama-cloud/gemma4:31b
This commit is contained in:
@@ -153,14 +153,14 @@ def parse_args() -> argparse.Namespace:
|
||||
)
|
||||
parser.add_argument(
|
||||
"--llm-engine",
|
||||
choices=["ollama", "opencode", "apple", "macos", "claude"],
|
||||
default="ollama",
|
||||
help="LLM engine to use: ollama/opencode for Ollama/Cloud models, apple/macos for local MLX, claude for Claude Code.",
|
||||
choices=["opencode", "ollama", "apple", "macos", "claude"],
|
||||
default="opencode",
|
||||
help="LLM engine to use: opencode/ollama for OpenCode Cloud models (gemma4:31b), apple/macos for local MLX, claude for Claude Code.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--ollama-model",
|
||||
default="gemma4:31b",
|
||||
help="Ollama / OpenCode model name (default gemma4:31b).",
|
||||
"--opencode-model",
|
||||
default="ollama-cloud/gemma4:31b",
|
||||
help="OpenCode Cloud model (default ollama-cloud/gemma4:31b).",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--ollama-host",
|
||||
@@ -497,18 +497,17 @@ def build_claude_options(args: argparse.Namespace, vocabulary=None, brain=None)
|
||||
|
||||
|
||||
def build_llm(args: argparse.Namespace, vocabulary=None, brain=None, observer=None):
|
||||
if args.llm_engine in ("ollama", "opencode"):
|
||||
from ollama_llm import OllamaLLM, probe_ollama, get_default_ollama_host
|
||||
if args.llm_engine in ("opencode", "ollama"):
|
||||
from opencode_llm import OpenCodeLLM, probe_opencode
|
||||
|
||||
host = args.ollama_host or get_default_ollama_host()
|
||||
logger.info(f"LLM: Ollama / OpenCode ({args.ollama_model} @ {host})")
|
||||
available, reason = probe_opencode(args.opencode_model)
|
||||
logger.info(f"LLM: OpenCode Cloud ({reason})")
|
||||
personality = read_personality(args.cwd) or "You are a helpful voice assistant."
|
||||
system_prompt = personality + "\n\n" + VOICE_STYLE
|
||||
if brain and (memory := brain.prompt_block()):
|
||||
system_prompt += "\n\n" + memory
|
||||
return OllamaLLM(
|
||||
model=args.ollama_model,
|
||||
host=host,
|
||||
return OpenCodeLLM(
|
||||
model=args.opencode_model,
|
||||
system_prompt=system_prompt,
|
||||
observer=observer,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user