Commit 989140d
authored
feat: add extraBody support to model aliases (#437)
## Summary
Adds `extraBody` (extra body fields) support to model aliases, matching
the existing functionality at the provider and provider-model levels.
This allows injecting extra fields into request bodies for all requests
routed through a given alias.
### Merge priority
Provider-level `extraBody` → Model-level `extraBody` → **Alias-level
`extraBody`** (highest priority, overrides both)
## Changes
### Backend
- **Schema**: Add `extra_body` column to `model_aliases` table (SQLite:
`text`, Postgres: `jsonb`)
- **Config**: Add `extraBody: z.record(z.string(), z.any()).optional()`
to `ModelConfigSchema`
- **Config Repository**: Read/write `extraBody` in `rowToModelConfig`
and `saveAlias`
- **Dispatcher**: Merge alias-level `extraBody` in all 4 dispatch paths
(chat, embeddings, speech, image generation)
- **Tests**: Update test to handle pending migration column
### Frontend
- **API**: Add `extraBody` to `Alias` interface, `saveAlias`, and
`getAliases`
- **UI**: Add `AliasExtraBodyEditor` component (key-value pair editor)
inside the Advanced disclosure in the alias edit modal
### Migrations
- SQLite: `ALTER TABLE model_aliases ADD extra_body text`
- Postgres: `ALTER TABLE model_aliases ADD COLUMN extra_body jsonb`
## Test plan
- [x] All 1320 backend tests pass
- [x] Frontend builds and typechecks cleanly
- [x] Pre-commit hooks pass (tests, lint, format, typecheck, frontend
build)
- [ ] Manual: create alias with extraBody fields, verify they appear in
dispatched request payloads
- [ ] Manual: verify alias-level extraBody overrides
provider/model-level with same keys15 files changed
Lines changed: 6383 additions & 1 deletion
File tree
- packages
- backend
- drizzle
- migrations_pg
- meta
- migrations
- meta
- schema
- postgres
- sqlite
- src
- db
- __tests__
- services
- frontend/src
- components/models
- lib
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments