Skip to content

admin /providers page and dynamic llms settings#199

Open
jrhizor wants to merge 1 commit into
mainfrom
providers/5-admin-ui
Open

admin /providers page and dynamic llms settings#199
jrhizor wants to merge 1 commit into
mainfrom
providers/5-admin-ui

Conversation

@jrhizor

@jrhizor jrhizor commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Completes PR 5 of the provider migration (#153) — the UI data-binding layer on top of the worker dispatch that landed in #197.

  • New /admin/providers route. Renders the current SCRAPE_TARGETS configuration (model, provider, version, webSearch), the full provider registry with isConfigured() credential status, and a per-target Test button that calls the real provider with a canned prompt and shows pass/fail + latency + a sample of the response.
  • /app/$brand/settings/llms is now data-driven. The three hardcoded ChatGPT/Claude/Google cards are gone; the page now renders one card per active SCRAPE_TARGETS model using getModelMeta for labels + icons. Toggles write to brand.enabledModels via a new updateBrandEnabledModelsFn server function.
  • Exact enabledModels semantics (match selectTargetsForBrand in packages/lib/src/providers/runner.ts:13, which is what the worker enforces):
    • null — no override, every configured target runs.
    • [] — explicit opt-out, nothing runs for this brand.
    • [x, y, ...] — opt-in list; every entry must be in the current SCRAPE_TARGETS or the server-side validator rejects the save.
    • "Reset to default (all models)" button is the escape hatch that persists null, so brands can opt out of the opt-in list.
  • Orphan handling. If a brand's enabledModels references a model no longer in SCRAPE_TARGETS (ops removed it from the env), the settings page flags it visibly and drops it from the payload on next save — before the worker would have thrown on next dispatch.
  • Whitelabel report-run coupling. WHITELABEL_REPORT_RUNS_PER_MODEL moved from apps/worker/src/report-worker.ts into @workspace/lib/providers so the web can read it without importing worker code. /admin/providers now renders a warning badge next to any active target missing from that map on DEPLOYMENT_MODE=whitelabel, where report generation would otherwise throw on first run.

Test plan

  • pnpm turbo build — all 6 packages compile; routeTree.gen.ts regenerated.
  • pnpm turbo test — 206 tests pass (150 lib + 56 web); no new tests needed (the runner semantics this binds to are already covered by selectTargetsForBrand's unit tests).

…ration)

- Adds `/admin/providers` showing active SCRAPE_TARGETS, per-provider configured
  status, and a per-target smoke-test button (real call, latency + sample).
- Replaces the three hardcoded ChatGPT/Claude/Google cards on
  `/app/$brand/settings/llms` with one card per active model; toggles write to
  `brand.enabledModels`. Semantics match `selectTargetsForBrand` that landed in
  PR 4: null = all enabled, [] = explicit opt-out (nothing runs), [...] =
  opt-in. Orphaned entries from a shrunk SCRAPE_TARGETS are flagged and
  dropped on save.
- Surfaces the whitelabel report-run coupling: any SCRAPE_TARGETS model not
  in `WHITELABEL_REPORT_RUNS_PER_MODEL` gets a warning badge on the providers
  page on `DEPLOYMENT_MODE=whitelabel`. Constant moved into
  `@workspace/lib/providers` so the web can read it without importing worker
  code.
- Adds "Providers" to the admin sidebar.

Completes PR 5 — the provider migration scope from #153 is now closed.
@vercel

vercel Bot commented Apr 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
elmo Ready Ready Preview, Comment Apr 22, 2026 11:31pm

Request Review

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