feat: multi-provider model support via majordomo (local Ollama, OpenAI-compatible, etc.)
Build & push image / build-and-push (push) Successful in 18s
Build & push image / build-and-push (push) Successful in 18s
Replace the hardcoded ollama.Cloud binding with majordomo's provider registry, so Gadfly can target any backend majordomo supports without code changes. - cmd/gadfly/model.go: resolveModel() — GADFLY_PROVIDER (default ollama-cloud) prefixes bare model ids; GADFLY_MODEL may be a full provider/model spec, alias, or failover chain (verbatim). GADFLY_BASE_URL constructs openai/ollama/anthropic/ google directly at a custom endpoint (OpenAI-compatible + local/remote Ollama). GADFLY_API_KEY else the provider's standard env var. + buildSpec unit tests. - run.sh: provider-aware key gate (local Ollama needs none); maps OLLAMA_CLOUD_API_KEY -> OLLAMA_API_KEY; provider/base-url/key inherited by the binary. Gadfly-branded comment. - entrypoint.sh: GADFLY_MODELS alias for OLLAMA_REVIEW_MODELS; provider passthrough. - examples + README: Models & providers section. Upfront: only the Ollama paths (local + OpenAI-compatible-against-Ollama) are tested; OpenAI/Anthropic/Google are wired via majordomo but UNTESTED (no spend). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,8 @@ it. Drop one file in your repo and set a couple of secrets/vars:
|
||||
`.gitea/workflows/adversarial-review.yml` in your repo.
|
||||
2. Add repo config:
|
||||
- **secret** `OLLAMA_CLOUD_API_KEY` — your [Ollama Cloud](https://ollama.com) key (empty
|
||||
⇒ Gadfly posts a harmless "not configured" notice instead of reviewing).
|
||||
⇒ Gadfly posts a harmless "not configured" notice instead of reviewing). *Not needed if
|
||||
you point Gadfly at a different provider — see [Models & providers](#models--providers).*
|
||||
- **var** `OLLAMA_REVIEW_MODELS` *(optional)* — comma-separated model ids
|
||||
(default `qwen3-coder:480b-cloud,gpt-oss:120b-cloud`). One comment per model.
|
||||
- **var** `GADFLY_ALLOWED_USERS` *(optional)* — who may re-trigger via comment; empty ⇒
|
||||
@@ -49,6 +50,35 @@ it. Drop one file in your repo and set a couple of secrets/vars:
|
||||
`GITEA_TOKEN` is provided automatically by Actions; comments post as the `gitea-actions`
|
||||
user, scoped to that repo — no bot account needed.
|
||||
|
||||
## Models & providers
|
||||
|
||||
Gadfly is built on [majordomo](https://gitea.stevedudenhoeffer.com/steve/majordomo), so the
|
||||
reviewer model is not hard-wired — it can target anything majordomo supports. Pick a provider
|
||||
by setting `GADFLY_PROVIDER` (used to prefix bare model ids); point at a custom endpoint with
|
||||
`GADFLY_BASE_URL`; supply a key with `GADFLY_API_KEY` or the provider's standard env var. A
|
||||
`GADFLY_MODEL`/`GADFLY_MODELS` value that already contains a `provider/` prefix (or is a
|
||||
majordomo failover chain / alias) is used verbatim.
|
||||
|
||||
| Provider | `GADFLY_PROVIDER` | Key env | Status |
|
||||
|----------|-------------------|---------|--------|
|
||||
| **Ollama Cloud** (default) | `ollama-cloud` | `OLLAMA_API_KEY` / `OLLAMA_CLOUD_API_KEY` | ✅ in active use |
|
||||
| **Local Ollama** | `ollama` | none (`OLLAMA_HOST` or `GADFLY_BASE_URL` for a remote daemon) | ✅ tested |
|
||||
| **OpenAI-compatible** (incl. local Ollama's `/v1`) | `openai` + `GADFLY_BASE_URL` | `OPENAI_API_KEY` (any non-empty for Ollama) | ✅ tested against Ollama |
|
||||
| **OpenAI** | `openai` | `OPENAI_API_KEY` | ⚠️ wired, **untested** |
|
||||
| **Anthropic** | `anthropic` | `ANTHROPIC_API_KEY` | ⚠️ wired, **untested** |
|
||||
| **Google (Gemini)** | `google` | `GOOGLE_API_KEY` / `GEMINI_API_KEY` | ⚠️ wired, **untested** |
|
||||
|
||||
> ### 🧪 Honest status
|
||||
> Only the **Ollama** paths above are actually exercised. The OpenAI / Anthropic / Google
|
||||
> providers come "for free" from majordomo's abstraction and *should* work, but I haven't
|
||||
> spent money verifying them — treat them as untested. The OpenAI-**compatible** path **is**
|
||||
> tested, because you can point it at a local Ollama (`GADFLY_BASE_URL=http://localhost:11434/v1`)
|
||||
> and exercise the exact same code an OpenAI/OpenRouter endpoint would hit, for free. If you
|
||||
> try a cloud provider and it works (or doesn't), please open an issue.
|
||||
|
||||
For arbitrary endpoints you can also skip `GADFLY_PROVIDER`/`GADFLY_BASE_URL` and define a
|
||||
majordomo `LLM_*` env DSN, then reference it by name in `GADFLY_MODEL` (advanced; HTTPS only).
|
||||
|
||||
### Triggers
|
||||
|
||||
1. A **new/reopened/ready** non-draft PR — automatic.
|
||||
@@ -81,8 +111,10 @@ The reviewer binary reads these (the stub/entrypoint set sane defaults):
|
||||
|
||||
| Env | Default | Meaning |
|
||||
|-----|---------|---------|
|
||||
| `OLLAMA_API_KEY` | — | Ollama Cloud bearer key (required for real reviews) |
|
||||
| `GADFLY_MODEL` | — | model id |
|
||||
| `GADFLY_MODEL` | — | model id, or `provider/model` spec, or majordomo alias/chain |
|
||||
| `GADFLY_PROVIDER` | `ollama-cloud` | provider prefix for a bare model id |
|
||||
| `GADFLY_BASE_URL` | — | override endpoint (OpenAI/Ollama-compatible servers) |
|
||||
| `GADFLY_API_KEY` | — | provider key; falls back to the provider's standard env |
|
||||
| `GADFLY_MAX_STEPS` | 24 | review-pass tool-step cap |
|
||||
| `GADFLY_RECHECK` | on | set `0`/`false` to skip the recheck pass |
|
||||
| `GADFLY_RECHECK_MAX_STEPS` | 16 | recheck-pass step cap |
|
||||
|
||||
Reference in New Issue
Block a user