Skip to content

feat(admin): let custom providers declare upstream models - #446

Open
misswell wants to merge 1 commit into
astaxie:mainfrom
misswell:codex/provider-manual-models
Open

misswell wants to merge 1 commit into
astaxie:mainfrom
misswell:codex/provider-manual-models

Conversation

@misswell

Copy link
Copy Markdown

Summary

Some upstream providers do not expose a model-list API, so operators cannot add models through the admin UI: the create/edit form requires loading a discovered catalog first. The backend already supports catalog_id: "custom" with an explicit custom_models array (and preserve_catalog on update), but the frontend had no way to populate it.

This PR adds a manual model entry path so those providers can be configured without a discovery endpoint.

Related Issue

N/A

Changes

  • Add a ProviderManualModels editor panel for entering an upstream model ID plus an optional display name, with validation for empty input, commas, newlines, duplicates, and already-imported models.
  • Show the manual entry panel in the custom-upstream quick-connect flow and on the "Models" tab when editing a non-account provider.
  • Merge manual entries with the discovered catalog, letting manual entries override a discovered model with the same ID so an operator-entered display name persists.
  • Send manual-only configurations as catalog_id: "custom", custom_models, and model_category: "", with preserve_catalog: true on update.
  • Allow provider creation when manual models are present even if discovery is unavailable or stale, while keeping the existing "reload the catalog" prompt when it is still required.

Type of Change

  • Bug fix
  • New feature
  • Refactor or maintenance
  • Documentation
  • Deployment or configuration

Verification

  • npm run test:domain — 199 pass
  • npm run test:components — 111 files / 824 tests pass
  • npm run typecheck — pass
  • npm run lint — pass
  • npm run build — pass
  • node --test tools/*.test.mjs — 205 pass
  • node tools/check-ui-translations.mjs — pass
  • node tools/check-source-lines.mjs — pass
  • git diff --check — clean

New tests cover the validation/merge helpers, the panel rendering, and an edit-mode save that keeps the existing catalog options while sending the manual model.

Compatibility, Security, and Operations

  • Uses existing backend request fields; no API, schema, or migration changes.
  • No new environment variables or deployment steps.
  • UI strings are translated in English, Japanese, and Russian.

Checklist

  • The PR title and body are written in English.
  • Tests were added or updated for behavior changes, or the reason they are unnecessary is documented.
  • No credentials, local .env files, databases, backups, or runtime logs are included.
  • Environment variable changes are synchronized across examples, Compose, start.sh, and deployment documentation where applicable.
  • Shared user-facing behavior is documented consistently in English, Simplified Chinese, and Japanese where applicable.
  • data/model-catalog.yaml remains tracked and catalog changes were reviewed where applicable.
  • git diff --check passes.

@misswell

Copy link
Copy Markdown
Author

CI shows action_required instead of running — that's the first-time-contributor approval gate, so no job has started yet. Could a maintainer approve the workflow runs?

I pre-ran the equivalent checks locally at this exact head (569701d7):

  • frontend: npm ci, lint, typecheck, npm test (824 passed), npm run build
  • repository gates: node --test tools/*.test.mjs, doc/UI translation, env contract, source-line check, git diff --check
  • backend: gofmt -l clean, go vet ./..., 4-shard suite via node tools/test-backend-shard.mjs N 4

Happy to adjust anything if you'd rather see a different shape.

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