Skip to content

feat: add local model support (RamaLama) with optional managed lifecycle#8

Merged
pridolfi merged 2 commits intomainfrom
local-model
Mar 18, 2026
Merged

feat: add local model support (RamaLama) with optional managed lifecycle#8
pridolfi merged 2 commits intomainfrom
local-model

Conversation

@pridolfi
Copy link
Copy Markdown
Owner

  • Add OpenAI-compatible local backend (SSHQ_USE_LOCAL, SSHQ_LOCAL_BASE_URL, SSHQ_LOCAL_MODEL); default model llama3.2:1b for Ollama/RamaLama
  • When SSHQ_USE_LOCAL=1 and SSHQ_LOCAL_BASE_URL unset, start RamaLama on connect (port 8080 or SSHQ_RAMALAMA_PORT) and stop it on disconnect
  • Extend backends with max_tokens (256 for /ask, 1024 for /analyze) to cap repetition; add optional max_tokens to Gemini/Groq/local
  • Post-process /ask responses: strip markdown code blocks and return a single shell command; add system prompt rule to avoid unnecessary sudo
  • Allow CLI to run without API keys when SSHQ_USE_LOCAL=1
  • Document local/managed mode and env vars in README; add tests for backend selection and command extraction

- Add OpenAI-compatible local backend (SSHQ_USE_LOCAL, SSHQ_LOCAL_BASE_URL,
  SSHQ_LOCAL_MODEL); default model llama3.2:1b for Ollama/RamaLama
- When SSHQ_USE_LOCAL=1 and SSHQ_LOCAL_BASE_URL unset, start RamaLama on
  connect (port 8080 or SSHQ_RAMALAMA_PORT) and stop it on disconnect
- Extend backends with max_tokens (256 for /ask, 1024 for /analyze) to cap
  repetition; add optional max_tokens to Gemini/Groq/local
- Post-process /ask responses: strip markdown code blocks and return a single
  shell command; add system prompt rule to avoid unnecessary sudo
- Allow CLI to run without API keys when SSHQ_USE_LOCAL=1
- Document local/managed mode and env vars in README; add tests for backend
  selection and command extraction

Signed-off-by: Pablo Ridolfi <pridolfi@redhat.com>
- Add tests/test_functional.py: spawns Podman aarch64 Ubuntu container,
  runs sshq server with mocked backend, SSHs with reverse tunnel, runs
  "q replace foo by bar in test.txt" and "q --analyze /proc/cpuinfo
  show cpu features...", asserts expected command and CPU features output.
- Add tests/docker/Dockerfile: Ubuntu 24.04 with openssh-server and
  python3 for the test container. Test builds image with its public key
  copied in (avoids rootless Podman bind-mount ownership issues).
- Register pytest marker "functional" in pyproject.toml. Test skips when
  Podman is not available.

Signed-off-by: Pablo Ridolfi <pridolfi@redhat.com>
@pridolfi pridolfi merged commit 9cc5c90 into main Mar 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant