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:
+19
-8
@@ -87,11 +87,21 @@ case "$PROVIDER" in
|
||||
ollama)
|
||||
# Agentic lane: hand off to the cmd/gadfly binary, which runs a tool-using
|
||||
# agent over the checked-out repo so it can verify findings instead of
|
||||
# guessing from the diff. The workflow builds the binary and exports
|
||||
# GADFLY_BIN + GADFLY_REPO_DIR; we fall back to sane defaults for a
|
||||
# local run.
|
||||
if [ -z "${OLLAMA_CLOUD_API_KEY:-}" ]; then
|
||||
REVIEW="⚠️ \`OLLAMA_CLOUD_API_KEY\` is not configured; this reviewer was skipped."
|
||||
# guessing from the diff. The reviewer is majordomo-powered, so GADFLY_PROVIDER
|
||||
# selects the backend (default ollama-cloud); local Ollama, OpenAI, Anthropic,
|
||||
# Google and OpenAI/Ollama-compatible endpoints all work — see the README.
|
||||
|
||||
# Back-compat: map the consumer's OLLAMA_CLOUD_API_KEY secret onto the
|
||||
# OLLAMA_API_KEY env the ollama-cloud provider reads.
|
||||
if [ -n "${OLLAMA_CLOUD_API_KEY:-}" ] && [ -z "${OLLAMA_API_KEY:-}" ]; then
|
||||
export OLLAMA_API_KEY="$OLLAMA_CLOUD_API_KEY"
|
||||
fi
|
||||
GADFLY_PROVIDER_EFF="${GADFLY_PROVIDER:-ollama-cloud}"
|
||||
|
||||
# Only the default cloud provider strictly needs a key up front; local Ollama
|
||||
# and other providers either need none or read their own standard env var.
|
||||
if [ "$GADFLY_PROVIDER_EFF" = "ollama-cloud" ] && [ -z "${OLLAMA_API_KEY:-}" ] && [ -z "${GADFLY_API_KEY:-}" ]; then
|
||||
REVIEW="⚠️ No Ollama Cloud key configured (set \`OLLAMA_CLOUD_API_KEY\`) and \`GADFLY_PROVIDER\` is the default \`ollama-cloud\`; this reviewer was skipped."
|
||||
else
|
||||
BIN="${GADFLY_BIN:-gadfly}"
|
||||
if ! command -v "$BIN" >/dev/null 2>&1 && [ ! -x "$BIN" ]; then
|
||||
@@ -101,8 +111,9 @@ case "$PROVIDER" in
|
||||
DIFF_FILE="$(mktemp)"
|
||||
ERR_FILE="${DIFF_FILE}.err"
|
||||
printf '%s' "$FULL_DIFF" > "$DIFF_FILE"
|
||||
# GADFLY_PROVIDER / GADFLY_BASE_URL / GADFLY_API_KEY and provider key
|
||||
# envs (OPENAI_API_KEY, …) are inherited from the process environment.
|
||||
REVIEW="$(
|
||||
OLLAMA_API_KEY="$OLLAMA_CLOUD_API_KEY" \
|
||||
GADFLY_MODEL="$MODEL" \
|
||||
GADFLY_REPO_DIR="$REPO_DIR" \
|
||||
GADFLY_DIFF_FILE="$DIFF_FILE" \
|
||||
@@ -142,8 +153,8 @@ $(tail -c 1500 agy.err 2>/dev/null)
|
||||
esac
|
||||
|
||||
# --- assemble comment -------------------------------------------------------
|
||||
COMMENT="$(printf '%s\n### 🔭 Adversarial review — `%s` (%s)\n\n%s\n\n<sub>Automated adversarial review. Advisory only — does not block merge.</sub>' \
|
||||
"$MARKER" "$MODEL" "$PROVIDER" "$REVIEW")"
|
||||
COMMENT="$(printf '%s\n### 🪰 Gadfly review — `%s` (%s)\n\n%s\n\n<sub>Automated adversarial review by Gadfly. Advisory only — does not block merge.</sub>' \
|
||||
"$MARKER" "$MODEL" "${GADFLY_PROVIDER_EFF:-$PROVIDER}" "$REVIEW")"
|
||||
POST_BODY="$(jq -n --arg b "$COMMENT" '{body:$b}')"
|
||||
|
||||
# --- upsert by marker -------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user