Skip to content

feat: OLLAMA_* settings for an existing Ollama server - #282

Open
TheBlackSide243 wants to merge 1 commit into
Anyesh:mainfrom
TheBlackSide243:pr/ollama-client
Open

TheBlackSide243 wants to merge 1 commit into
Anyesh:mainfrom
TheBlackSide243:pr/ollama-client

Conversation

@TheBlackSide243

@TheBlackSide243 TheBlackSide243 commented Oct 18, 2026 •

Copy link
Copy Markdown

Description

Adds a shorthand for pointing Wardrowbe at an Ollama server that already runs elsewhere, such as another container on the same host or another machine.

Variable Fills in
OLLAMA_BASE_URL AI_BASE_URL, with /v1 added for the OpenAI-compatible API
OLLAMA_MODEL both AI_VISION_MODEL and AI_TEXT_MODEL
OLLAMA_VISION_MODEL / OLLAMA_TEXT_MODEL only one of the two
OLLAMA_TIMEOUT AI_TIMEOUT
  • Ollama stays a separate service: Wardrowbe only calls its HTTP API and never runs or downloads a model itself.
  • Endpoints a user adds in Settings > AI still take precedence. These variables only set the server default.
  • docker-compose.yml passes the variables through, and .env.example documents them.

The change is small and independent. It branches from main and touches only config.py, the compose file and .env.example.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the project's coding style
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally
  • I have updated documentation as needed
  • My changes don't introduce new warnings or errors

Testing

  • Backend: ruff check, ruff format --check and the full pytest suite, including the compose-to-settings checks in test_deploy_env.py.
  • By hand: running against the Ollama app on my TrueNAS (OLLAMA_BASE_URL=http://<nas>:30068).

Test Environment

  • Docker Compose
  • Kubernetes
  • Local development

🤖 Generated with Claude Code

Summary by Sourcery

Enable Wardrowbe to use an existing external Ollama server through environment-based configuration.

New Features:

  • Add OLLAMA_* configuration shorthand for connecting to an externally hosted Ollama server and populating the corresponding AI endpoint, model, and timeout settings.

Enhancements:

  • Preserve existing AI configuration behavior when Ollama-specific variables are not provided, including support for explicit /v1 endpoints and separate vision/text models.

Build:

  • Pass OLLAMA_* variables through Docker Compose backend configuration.

Tests:

  • Add coverage for Ollama configuration mapping, endpoint normalization, model overrides, and compatibility with existing AI settings.

OLLAMA_BASE_URL, OLLAMA_MODEL, OLLAMA_VISION_MODEL, OLLAMA_TEXT_MODEL and
OLLAMA_TIMEOUT fill in the AI_* settings (the /v1 suffix is added for the
OpenAI-compatible API). Ollama stays a separate service: Wardrowbe only
calls its HTTP API and never runs or downloads a model itself. Endpoints a
user adds in Settings > AI still take precedence; these are the default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Sorry @TheBlackSide243, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 6 days and 22 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@github-actions github-actions Bot added docker Pull requests that update docker code python Pull requests that update python code labels Oct 18, 2026
@sourcery-ai

sourcery-ai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduces an external-Ollama configuration shorthand: Pydantic post-validation maps OLLAMA_* variables into the existing AI settings, Compose forwards them to the backend, and tests cover URL/model/timeout mapping and fallback behavior.

Flow diagram for external Ollama settings mapping

flowchart LR
    Env[OLLAMA_* environment variables] --> Compose[docker-compose.yml backend environment]
    Compose --> Settings[Settings.apply_ollama_settings]
    Settings --> AI[AI_BASE_URL and AI_* settings]
    AI --> Client[Wardrowbe HTTP client]
    Client --> Ollama[External Ollama server]
    User[User AI endpoints] --> AI
    User -->|takes precedence| Client
Loading

File-Level Changes

Change Details Files
Added OLLAMA_* settings that are translated into the existing AI configuration during Pydantic settings validation.
  • Added optional server URL, shared/per-modality model, and timeout fields.
  • Normalized the Ollama URL to include a single trailing /v1 API path.
  • Applied shared model values to both modalities, with modality-specific values taking precedence.
  • Mapped the timeout and preserved existing AI settings when Ollama variables are absent.
  • Added coverage for mappings, URL normalization, modality override behavior, and fallback behavior.
backend/app/config.py
backend/tests/test_ollama_settings.py
Exposed the Ollama shorthand variables through the backend Docker Compose environment.
  • Passed all five OLLAMA_* variables into the backend container with empty defaults.
docker-compose.yml
Documented the new Ollama environment variables and their purpose for external Ollama deployments.
  • Added variable descriptions and default/override behavior to the example environment configuration.
.env.example

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Pull requests that update docker code python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants