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:
+10
-3
@@ -31,7 +31,11 @@
|
||||
# COMMENT_ID comment id, for the 👀 reaction (issue_comment only)
|
||||
# ACTOR github.actor (the user who triggered)
|
||||
# Optional config:
|
||||
# OLLAMA_REVIEW_MODELS comma-separated model ids (default below)
|
||||
# GADFLY_MODELS comma-separated model ids/specs (alias: OLLAMA_REVIEW_MODELS)
|
||||
# GADFLY_PROVIDER majordomo provider for bare model ids (default ollama-cloud;
|
||||
# e.g. "ollama" local, "openai", "anthropic", "google")
|
||||
# GADFLY_BASE_URL override backend endpoint (OpenAI/Ollama-compatible servers)
|
||||
# GADFLY_API_KEY provider key (else provider's standard env: OPENAI_API_KEY, …)
|
||||
# GADFLY_TRIGGER_PHRASE comment phrase that triggers a re-review (default "@gadfly review")
|
||||
# GADFLY_ALLOWED_USERS comma-separated usernames allowed to comment-trigger;
|
||||
# empty => fall back to "is a repo collaborator"
|
||||
@@ -119,8 +123,11 @@ git clone --depth=1 --branch "$BRANCH" "$CLONE_URL" "$REPO_DIR" 2>/dev/null \
|
||||
|| die "clone of ${REPO_PATH}@${BRANCH} failed"
|
||||
|
||||
# --- review once per model -------------------------------------------------
|
||||
MODELS="${OLLAMA_REVIEW_MODELS:-$DEFAULT_MODELS}"
|
||||
log "models: ${MODELS}"
|
||||
# GADFLY_MODELS is the provider-agnostic name; OLLAMA_REVIEW_MODELS is kept as a
|
||||
# back-compat alias. GADFLY_PROVIDER / GADFLY_BASE_URL / GADFLY_API_KEY and any
|
||||
# provider key envs (OPENAI_API_KEY, …) are inherited by run.sh and the binary.
|
||||
MODELS="${GADFLY_MODELS:-${OLLAMA_REVIEW_MODELS:-$DEFAULT_MODELS}}"
|
||||
log "provider: ${GADFLY_PROVIDER:-ollama-cloud}; models: ${MODELS}"
|
||||
IFS=',' read -ra ARR <<< "$MODELS" || true
|
||||
for raw in "${ARR[@]}"; do
|
||||
m="$(echo "$raw" | tr -d '[:space:]')"
|
||||
|
||||
Reference in New Issue
Block a user