From 0615ee93c839fa26c5b6ddfceca6828fa96bdd7b Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sat, 31 Jan 2026 15:27:57 +0000 Subject: [PATCH] Add CLI commands and Gitea Actions workflow --- local_code_assistant/commands/base.py | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 local_code_assistant/commands/base.py diff --git a/local_code_assistant/commands/base.py b/local_code_assistant/commands/base.py new file mode 100644 index 0000000..0ada5f1 --- /dev/null +++ b/local_code_assistant/commands/base.py @@ -0,0 +1,50 @@ +"""Base command class for Local Code Assistant.""" + +from typing import Any, Optional + +from local_code_assistant.services.config import ConfigService +from local_code_assistant.services.ollama import OllamaService + + +class BaseCommand: + """Base class for CLI commands.""" + + def __init__(self, ollama: OllamaService, config: ConfigService): + """Initialize base command. + + Args: + ollama: Ollama service instance. + config: Configuration service instance. + """ + self.ollama = ollama + self.config = config + + def run(self, *args, **kwargs) -> Any: + """Execute the command. Override in subclasses. + + Returns: + Command result. + """ + raise NotImplementedError("Subclasses must implement run()") + + def _get_model(self, model: Optional[str] = None) -> str: + """Get model to use, falling back to default. + + Args: + model: Specified model or None. + + Returns: + Model name. + """ + return model or self.config.ollama_model + + def _get_temperature(self, temperature: Optional[float] = None) -> float: + """Get temperature, falling back to default. + + Args: + temperature: Specified temperature or None. + + Returns: + Temperature value. + """ + return temperature if temperature is not None else self.config.temperature \ No newline at end of file