fix(models): preserve preset rename compatibility

This commit is contained in:
Xubin Ren
2026-08-16 11:50:56 +08:00
parent a956fe1d60
commit 0a6ee1c539
20 changed files with 307 additions and 46 deletions
+1 -1
View File
@@ -1435,7 +1435,7 @@ Existing configs do not need to change. Direct `agents.defaults.model`, `provide
}
```
`modelPresets` is a top-level object. Each key (`fast`, `deep`, `coding`, etc.) is the preset's one canonical name: it is shown in the interface, passed to `/model <name>`, and referenced by defaults, fallbacks, sessions, and Dream. Names must be unique ignoring case. Each preset supports:
`modelPresets` is a top-level object. Each key (`fast`, `deep`, `coding`, etc.) is the preset's one canonical name: it is shown in the interface, passed to `/model <name>`, and referenced by defaults, fallbacks, sessions, and Dream. New and renamed presets must be unique ignoring case. Existing keys accepted by earlier releases remain loadable so upgrades do not break startup. Each preset supports:
Older configs may still contain a `label` inside a preset. It is accepted when loading for compatibility but ignored; the object key remains the canonical name.
+5 -7
View File
@@ -32,16 +32,14 @@ with ones you control:
```json
{
"modelPresets": {
"fast": {
"label": "Fast",
"Fast": {
"provider": "primary-provider",
"model": "primary-model-id",
"maxTokens": 4096,
"contextWindowTokens": 65536,
"temperature": 0.1
},
"deep": {
"label": "Deep",
"Deep": {
"provider": "fallback-provider",
"model": "fallback-model-id",
"maxTokens": 4096,
@@ -51,8 +49,8 @@ with ones you control:
},
"agents": {
"defaults": {
"modelPreset": "fast",
"fallbackModels": ["deep"]
"modelPreset": "Fast",
"fallbackModels": ["Deep"]
}
}
}
@@ -69,7 +67,7 @@ for common providers.
how much context can fit.
- Put cheaper or faster fallbacks before expensive ones when acceptable.
- Use `/model <preset>` for runtime switching without editing config.
- Keep labels human-readable for WebUI model lists.
- Keep preset names human-readable; the same name appears in the WebUI and `/model`.
## Security notes
+2 -3
View File
@@ -179,8 +179,7 @@ Merge this preset into `~/.nanobot/config.json` and select it:
}
},
"modelPresets": {
"ollamaPrefixStable": {
"label": "Ollama Llama 3.1 prefix-stable",
"Ollama Llama 3.1 prefix-stable": {
"provider": "ollama",
"model": "llama3.1:8b-prefix-stable-v1",
"maxTokens": 2048,
@@ -190,7 +189,7 @@ Merge this preset into `~/.nanobot/config.json` and select it:
},
"agents": {
"defaults": {
"modelPreset": "ollamaPrefixStable"
"modelPreset": "Ollama Llama 3.1 prefix-stable"
}
}
}
@@ -41,8 +41,7 @@ Merge this into `~/.nanobot/config.json`:
}
},
"modelPresets": {
"primary": {
"label": "Custom",
"Custom": {
"provider": "custom",
"model": "provider-model-name",
"maxTokens": 4096,
@@ -52,7 +51,7 @@ Merge this into `~/.nanobot/config.json`:
},
"agents": {
"defaults": {
"modelPreset": "primary"
"modelPreset": "Custom"
}
}
}