|
26 | 26 | ```json |
27 | 27 | { |
28 | 28 | "models": { "providers": { "<providerKey>": { "...": "..." } } }, |
| 29 | + "agentsDefaultsModels": { "<provider/model>": { "...": "..." } }, |
| 30 | + "agentsDefaultModel": { "primary": "<provider/model>", "fallbacks": ["<provider/model>"] }, |
29 | 31 | "baseHash": "<config hash>" |
30 | 32 | } |
31 | 33 | ``` |
|
113 | 115 | { |
114 | 116 | "modelList": "<gateway payload>", |
115 | 117 | "configHash": "<hash>", |
116 | | - "modelsConfig": { "providers": { "...": {} } } |
| 118 | + "modelsConfig": { "providers": { "...": {} } }, |
| 119 | + "agentsDefaultsModels": { "<provider/model>": { "...": "..." } }, |
| 120 | + "agentsDefaultModel": { "primary": "<provider/model>", "fallbacks": ["<provider/model>"] } |
117 | 121 | } |
118 | 122 | ``` |
119 | | -- `/api/models/save` forwards to `config.patch({ raw, baseHash, note })` with note `"MVP dashboard updated model/provider config"`. |
| 123 | +- `/api/models/save` forwards one combined `config.patch({ raw, baseHash, note })` with note `"MVP dashboard updated model/provider config"`. |
| 124 | +- Browser currently uses that combined patch to update three config slices together: |
| 125 | + - `models.providers` |
| 126 | + - `agents.defaults.models` |
| 127 | + - `agents.defaults.model` |
120 | 128 | - Browser editor depends on provider config round-tripping extra fields. Managed keys are `baseUrl|baseURL|url|apiKey|api|apiType|type|models`; everything else must survive save. |
121 | 129 | - Browser provider save normalizes legacy adapter fields `apiType` / `type` into gateway-schema `api` before calling `/api/models/save`. |
122 | 130 | - Browser provider delete / rename emits `models.providers.<key> = null` tombstones so `config.patch` actually removes old provider keys instead of merging them back. |
123 | 131 | - Browser provider model rows always serialize as object entries; when `name` is omitted in the form, save falls back to `name = id` to satisfy gateway schema. |
| 132 | +- Browser model allowlist save emits `agents.defaults.models.<provider/model> = null` tombstones for refs that were unchecked or removed, so stale allowlist entries do not merge back. |
| 133 | +- Browser “设为默认” UI writes `agents.defaults.model.primary`; when the selected default is cleared by draft changes, save may send `agentsDefaultModel = null` to remove the config key. |
124 | 134 | - `__OPENCLAW_REDACTED__` is a browser-only placeholder; save callers must remove it before sending. |
125 | 135 |
|
126 | 136 | #### Skills contract |
|
185 | 195 | - 404 route => `{ ok:false, error }` |
186 | 196 | - Models |
187 | 197 | - `/api/models` returns `configHash` and `modelsConfig` |
| 198 | + - `/api/models` also returns `agentsDefaultsModels` and `agentsDefaultModel` |
188 | 199 | - `/api/models/save` forwards `baseHash` |
| 200 | + - `/api/models/save` can patch `models.providers`, `agents.defaults.models`, and `agents.defaults.model` in one request |
189 | 201 | - provider extra fields survive round-trip save |
190 | 202 | - legacy provider `apiType` / `type` backfills and saves as `api` |
191 | 203 | - deleting or renaming a provider removes the old provider key after reload |
192 | 204 | - newly added provider models save as `{ id, name, ... }` objects instead of invalid string entries |
| 205 | + - unchecking a previously-allowlisted model removes the old `agents.defaults.models.<ref>` key after reload |
| 206 | + - selecting a default model persists `agents.defaults.model.primary` |
193 | 207 | - Skills |
194 | 208 | - `/api/skills/install` default `timeoutMs=120000` |
195 | 209 | - `/api/skills/update` accepts enable-only and env/apiKey payloads |
|
0 commit comments