Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(settings): drop image bindings whose provider row is gone

vastsaee5e15636ad7
diff --git a/crates/host-core/src/providers.rs b/crates/host-core/src/providers.rs
index 14c0bdbaa..d4f7b2f5e 100644
--- a/crates/host-core/src/providers.rs
+++ b/crates/host-core/src/providers.rs
@@ -30,7 +30,7 @@ pub use repository::{
create_provider, delete_provider, get_provider, list_providers, set_provider_secret,
update_provider,
};
-pub(crate) use repository::{delete_provider_row, provider_owner_plugin};
+pub(crate) use repository::{delete_provider_row, provider_exists, provider_owner_plugin};
pub(crate) use catalog::{
config_model_bindings, config_thinking_levels_override, config_with_model_bindings,
diff --git a/crates/host-core/src/providers/repository.rs b/crates/host-core/src/providers/repository.rs
index 0b180c163..36f8b9f0a 100644
--- a/crates/host-core/src/providers/repository.rs
+++ b/crates/host-core/src/providers/repository.rs
@@ -474,3 +474,18 @@ pub fn get_provider(
.optional()
.map_err(Into::into)
}
+
+/// Whether `id` names a row, whoever owns it.
+///
+/// Reference checks ask this instead of `get_provider` because they only need
+/// to know whether the row still exists: an existing row that is disabled or
+/// carries no credential keeps its references, since the user can repair that
+/// in Settings.
+pub(crate) fn provider_exists(db: &Database, id: &str) -> Result<bool> {
+ Ok(db
+ .conn()
+ .prepare_cached("SELECT 1 FROM providers WHERE id = ?1")?
+ .query_row(params![id], |_| Ok(()))
+ .optional()?
+ .is_some())
+}
diff --git a/crates/host-core/src/rpc/mod.rs b/crates/host-core/src/rpc/mod.rs
index 84181323a..16d6c7149 100644
--- a/crates/host-core/src/rpc/mod.rs
+++ b/crates/host-core/src/rpc/mod.rs
@@ -745,6 +745,63 @@ fn merge_settings_value(stored: Option<Value>, incoming: Value) -> Value {
Value::Object(merged)
}
+/// Drop image-generation bindings whose provider row is gone.
+///
+/// `settings.set` merges into the stored object and the shell writes whole
+/// snapshots back, so deleting a provider row used to leave `imageGeneration`
+/// naming an id that no longer resolves. Every `GenerateImages` call then
+/// answered `IMAGE_MODEL_UNAVAILABLE`, and once the candidate list was empty
+/// the settings row that owns the default hid itself, so the binding could
+/// neither run nor be repaired from the UI. A binding that cannot resolve is
+/// therefore not a preference the store keeps: the active default falls back
+/// to "no default" and the candidate list loses that entry, on read and on
+/// write alike. A provider that still exists but is disabled or carries no
+/// credential keeps its binding — that is a state the user repairs in
+/// Settings, and no reference to it is dropped here.
+///
+/// The same rule config sync already enforces when it applies a bundle
+/// (`validate_application_references`), applied to the local settings channel
+/// so a stale id cannot be written into or read out of the store.
+fn prune_unresolvable_image_bindings(
+ db: &crate::db::Database,
+ settings: &mut Value,
+) -> Result<bool> {
+ let Some(object) = settings.as_object_mut() else {
+ return Ok(false);
+ };
+ let resolves = |binding: &Value| -> Result<bool> {
+ match binding.get("providerId").and_then(Value::as_str) {
+ Some(provider_id) => providers::provider_exists(db, provider_id),
+ None => Ok(false),
+ }
+ };
+ let mut changed = false;
+ let active_is_stale = match object.get("imageGeneration") {
+ Some(binding) if !binding.is_null() => !resolves(binding)?,
+ _ => false,
+ };
+ if active_is_stale {
+ object.insert("imageGeneration".into(), Value::Null);
+ changed = true;
+ }
+ if let Some(Value::Array(candidates)) = object.get("imageGenerationModels").cloned() {
+ let mut kept = Vec::with_capacity(candidates.len());
+ let mut dropped = false;
+ for candidate in candidates {
+ if resolves(&candidate)? {
+ kept.push(candidate);
+ } else {
+ dropped = true;
+ }
+ }
+ if dropped {
+ object.insert("imageGenerationModels".into(), Value::Array(kept));
+ changed = true;
+ }
+ }
+ Ok(changed)
+}
+
fn effective_command_shell_id(settings: Option<&Value>) -> Option<String> {
let configured = settings
.and_then(|value| value.get("defaultCommandShell"))
@@ -1955,7 +2012,7 @@ async fn handle_request(
.db
.get_setting("app")
.map_err(|e| rpc_err(1000, e.to_string(), "INTERNAL"))?;
- Ok(normalize_settings_value(stored.unwrap_or_else(|| {
+ let mut settings = normalize_settings_value(stored.unwrap_or_else(|| {
json!({
"defaultMode": "agent",
"defaultCommandShell": tools::shell::default_shell_id(),
@@ -1969,7 +2026,19 @@ async fn handle_request(
},
"onboardingDismissed": false
})
- })))
+ }));
+ // Repair on read: a binding whose provider row is already gone —
+ // deleted by a build that did not prune, an uninstalled plugin, or
+ // synced bundle — is dropped here and the store is corrected, so
+ // the shell never presents a default the runtime must reject.
+ if prune_unresolvable_image_bindings(&st.db, &mut settings)
+ .map_err(|e| rpc_err(1000, e.to_string(), "INTERNAL"))?
+ {
+ st.db
+ .set_setting("app", &settings)
+ .map_err(|e| rpc_err(1000, e.to_string(), "INTERNAL"))?;
+ }
+ Ok(settings)
}
"settings.set" => {
validate_settings_value(&params)?;
@@ -1984,7 +2053,9 @@ async fn handle_request(
{
gate_default_command_shell_setting(&st)?;
}
- let settings = normalize_settings_value(merge_settings_value(stored, params));
+ let mut settings = normalize_settings_value(merge_settings_value(stored, params));
+ prune_unresolvable_image_bindings(&st.db, &mut settings)
+ .map_err(|e| rpc_err(1000, e.to_string(), "INTERNAL"))?;
st.db
.set_setting("app", &settings)
.map_err(|e| rpc_err(1000, e.to_string(), "INTERNAL"))?;
@@ -6485,6 +6556,154 @@ mod tests {
assert_eq!(settings["theme"], "light");
}
+ /// Creates a provider row through the RPC surface the shell uses.
+ async fn create_test_provider(
+ state: Arc<Mutex<AppState>>,
+ tx: mpsc::UnboundedSender<String>,
+ ) -> String {
+ let created = handle_request(
+ state,
+ "providers.create",
+ json!({
+ "name": "Image service",
+ "baseUrl": "http://localhost:8080/v1",
+ "authKind": "none",
+ "defaultModelId": "gpt-image-2.5"
+ }),
+ tx,
+ )
+ .await
+ .unwrap();
+ created["provider"]["id"].as_str().unwrap().to_string()
+ }
+
+ #[tokio::test]
+ async fn settings_set_drops_image_bindings_whose_provider_is_gone() {
+ let data_dir = tempfile::tempdir().unwrap();
+ let mut app_state = AppState::open(data_dir.path()).unwrap();
+ app_state.handshook = true;
+ let state = Arc::new(Mutex::new(app_state));
+ let (tx, _rx) = mpsc::unbounded_channel();
+ let provider_id = create_test_provider(state.clone(), tx.clone()).await;
+
+ // The shell writes whole snapshots back, so a binding for a row that no
+ // longer exists can arrive through an ordinary settings write.
+ handle_request(
+ state.clone(),
+ "settings.set",
+ json!({
+ "imageGeneration": { "providerId": provider_id, "modelId": "gpt-image-2.5" },
+ "imageGenerationModels": [
+ { "providerId": provider_id, "modelId": "gpt-image-2.5" },
+ { "providerId": "removed-service", "modelId": "gpt-image-2.5" }
+ ]
+ }),
+ tx.clone(),
+ )
+ .await
+ .unwrap();
+
+ let settings = handle_request(state.clone(), "settings.get", json!({}), tx.clone())
+ .await
+ .unwrap();
+ assert_eq!(
+ settings["imageGeneration"],
+ json!({ "providerId": provider_id, "modelId": "gpt-image-2.5" })
+ );
+ assert_eq!(
+ settings["imageGenerationModels"],
+ json!([{ "providerId": provider_id, "modelId": "gpt-image-2.5" }])
+ );
+
+ let stored = state.lock().await.db.get_setting("app").unwrap().unwrap();
+ assert_eq!(stored["imageGenerationModels"].as_array().unwrap().len(), 1);
+ }
+
+ #[tokio::test]
+ async fn settings_get_repairs_a_binding_left_by_a_deleted_provider() {
+ let data_dir = tempfile::tempdir().unwrap();
+ let mut app_state = AppState::open(data_dir.path()).unwrap();
+ app_state.handshook = true;
+ let state = Arc::new(Mutex::new(app_state));
+ let (tx, _rx) = mpsc::unbounded_channel();
+ let provider_id = create_test_provider(state.clone(), tx.clone()).await;
+
+ handle_request(
+ state.clone(),
+ "settings.set",
+ json!({
+ "imageGeneration": { "providerId": provider_id, "modelId": "gpt-image-2.5" },
+ "imageGenerationModels": [
+ { "providerId": provider_id, "modelId": "gpt-image-2.5" }
+ ]
+ }),
+ tx.clone(),
+ )
+ .await
+ .unwrap();
+ let deleted = handle_request(
+ state.clone(),
+ "providers.delete",
+ json!({ "id": provider_id }),
+ tx.clone(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(deleted["ok"], true);
+
+ // Reading the settings repairs what the deletion left behind, so a
+ // binding the runtime would reject never reaches the shell again.
+ let settings = handle_request(state.clone(), "settings.get", json!({}), tx.clone())
+ .await
+ .unwrap();
+ assert!(settings["imageGeneration"].is_null());
+ assert_eq!(settings["imageGenerationModels"], json!([]));
+
+ let stored = state.lock().await.db.get_setting("app").unwrap().unwrap();
+ assert!(stored["imageGeneration"].is_null());
+ assert_eq!(stored["imageGenerationModels"], json!([]));
+ }
+
+ #[tokio::test]
+ async fn settings_keep_image_bindings_for_a_disabled_provider() {
+ let data_dir = tempfile::tempdir().unwrap();
+ let mut app_state = AppState::open(data_dir.path()).unwrap();
+ app_state.handshook = true;
+ let state = Arc::new(Mutex::new(app_state));
+ let (tx, _rx) = mpsc::unbounded_channel();
+ let provider_id = create_test_provider(state.clone(), tx.clone()).await;
+ let disabled = handle_request(
+ state.clone(),
+ "providers.update",
+ json!({ "id": provider_id, "enabled": false }),
+ tx.clone(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(disabled["provider"]["enabled"], false);
+
+ // A row that still exists keeps its binding: an unavailable but
+ // present provider is a state the user repairs in Settings, and
+ // pruning it would silently discard the user's choice.
+ handle_request(
+ state.clone(),
+ "settings.set",
+ json!({
+ "imageGeneration": { "providerId": provider_id, "modelId": "gpt-image-2.5" }
+ }),
+ tx.clone(),
+ )
+ .await
+ .unwrap();
+ let settings = handle_request(state, "settings.get", json!({}), tx)
+ .await
+ .unwrap();
+ assert_eq!(
+ settings["imageGeneration"],
+ json!({ "providerId": provider_id, "modelId": "gpt-image-2.5" })
+ );
+ }
+
#[tokio::test]
async fn settings_set_same_shell_is_idempotent_during_an_active_turn() {
let Some(current_shell) = available_test_shell_id() else {
diff --git a/docs/project/unreleased.md b/docs/project/unreleased.md
index 82e8cb038..4d8c113cd 100644
--- a/docs/project/unreleased.md
+++ b/docs/project/unreleased.md
@@ -1,5 +1,10 @@
# Unreleased changes
+- Deleting a provider no longer leaves a dangling image-generation default.
+ An image default or marked candidate whose provider row is gone is dropped
+ on the next settings read or write, instead of staying stored as a binding
+ every generation request rejects as an unavailable model.
+
- Subagent topology cards and their live process rows now follow the main
conversation's responsive width behavior: long descriptions, paths,
commands, and summaries wrap inside the dock instead of requiring repeated
diff --git a/docs/spec/03-runtime/21-image-generation.md b/docs/spec/03-runtime/21-image-generation.md
index cb7ed4981..4aea0cf17 100644
--- a/docs/spec/03-runtime/21-image-generation.md
+++ b/docs/spec/03-runtime/21-image-generation.md
@@ -1,6 +1,6 @@
# Image generation and editing
-The desktop exposes `AppSettings.imageGeneration` as the current default image-generation binding and `AppSettings.imageGenerationModels` as the optional list of models marked for image generation. The legacy single binding remains supported: when the list is absent, it is treated as the only candidate. A null or empty current binding means no default; host-core validates and persists both fields through the existing settings store. No schema bump is needed. Each candidate is independent of the conversation default and references an existing enabled API-key or no-auth provider and one of its configured models.
+The desktop exposes `AppSettings.imageGeneration` as the current default image-generation binding and `AppSettings.imageGenerationModels` as the optional list of models marked for image generation. The legacy single binding remains supported: when the list is absent, it is treated as the only candidate. A null or empty current binding means no default; host-core validates and persists both fields through the existing settings store. No schema bump is needed. A reference that no longer matches an existing provider row is not persisted: host-core drops the current binding and the matching candidate on every settings read and write, mirroring the reference rule config sync applies when it applies a bundle, so a deleted provider cannot leave behind a default the runtime must reject. Each candidate is independent of the conversation default and references an existing enabled API-key or no-auth provider and one of its configured models.
## Configuration
@@ -9,7 +9,7 @@ image capabilities were marked or unmarked. It must not claim that an image
model was selected after deselection. Choosing an image default from the
summary menu retains the image-selection confirmation.
-Model Advanced exposes **Set as image model** alongside the image and document attachment capabilities in the model capability group, not as a separate control row. The checkbox is multi-select: saving a provider persists every checked model in `imageGenerationModels`; Cancel leaves settings unchanged. Saving candidates does not replace the default conversation model. Unchecking every image model on the provider that holds the current default clears that default, even when another provider still has a runnable candidate. The Models page drops the check and does not select the other candidate automatically. Unchecking the current model while another model on the same provider stays marked moves the default to the first runnable marked candidate. The unmarked model is available for chat again after saving and reopening settings. Saving another provider preserves a still-runnable image default. Below the default model row in the same defaults panel, **Image generation model** shows the current default and offers a menu to choose one from all marked candidates. When no candidate is configured, or none of them can be selected, the summary row is hidden. An existing candidate that is missing, disabled, credential-less or removed displays only **Currently unavailable** while another marked candidate can still be selected. OAuth accounts are not eligible; there is no fallback.
+Model Advanced exposes **Set as image model** alongside the image and document attachment capabilities in the model capability group, not as a separate control row. The checkbox is multi-select: saving a provider persists every checked model in `imageGenerationModels`; Cancel leaves settings unchanged. Saving candidates does not replace the default conversation model. Unchecking every image model on the provider that holds the current default clears that default, even when another provider still has a runnable candidate. The Models page drops the check and does not select the other candidate automatically. Unchecking the current model while another model on the same provider stays marked moves the default to the first runnable marked candidate. The unmarked model is available for chat again after saving and reopening settings. Saving another provider preserves a still-runnable image default. Below the default model row in the same defaults panel, **Image generation model** shows the current default and offers a menu to choose one from all marked candidates. When no candidate is configured, or none of them can be selected, the summary row is hidden. A candidate whose provider still exists but is disabled, credential-less or otherwise unusable displays only **Currently unavailable** while another marked candidate can still be selected; a candidate whose provider row is gone is dropped from the stored list on the next settings read or write instead of staying listed. OAuth accounts are not eligible; there is no fallback.
All marked provider/model pairs are excluded from the default conversation picker, provider quick-default action, and Composer model menu. Other providers with the same model ID remain independent. Existing conversation bindings and history are preserved; a conversation still pinned to any image candidate must select a chat model before sending. Runtime launch rejects every marked image model before inference.
### Provider model removal
@@ -20,7 +20,7 @@ touched. If it was the active image default, clear the default, even when anothe
runnable candidate remains on this or another provider. Cancel preserves
both the provider models and the image settings. Legacy single bindings follow
the same rule. Unchanged image selections retain the ordinary provider-save
-path. External provider changes can still leave an unavailable binding visible.
+path. External provider changes can still leave an unavailable binding visible until the next settings read or write, which drops a binding whose provider row is gone.
The existing chat-default repair still runs if the saved provider no longer
contains its selected chat model; otherwise the chat default is preserved.
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index e94cb4407..4ae65a46c 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -643,8 +643,8 @@ identify the platform validation still needed.
- **Preconditions**: App running; provider A saved and set as the app default model; a second provider B serving different models; one image-capable model configured on A and another on a different service.
- **Steps**: 1) Open Settings → Model configuration and add provider B; save without touching the Default model row. 2) Confirm the Default model row still names provider A and its exact model, and that a new session starts on it. 3) Set an image model as the default image model, then add a provider that also serves image models; save. 4) Confirm the Default image model row still names the earlier binding while the picker lists the new provider's image models as candidates. 5) Delete the provider that owned a default, then add a service that serves a model and an image model; save. 6) Confirm both defaults now resolve to that newly added provider.
-- **Expected**: Saving a new provider never repoints an app default that still resolves: the model default keeps the pairing the Default model row already renders, and the image default keeps its stored binding while its candidate list grows. A removed image model is cleared and requires an explicit new selection; a removed chat default still uses the existing chat repair rule. The explicit make-default actions and the edit path remain unchanged.
-- **Specs linked**: `03-runtime/13-model-catalog-and-selection.md`
+- **Expected**: Saving a new provider never repoints an app default that still resolves: the model default keeps the pairing the Default model row already renders, and the image default keeps its stored binding while its candidate list grows. A removed image model is cleared and requires an explicit new selection; a removed chat default still uses the existing chat repair rule. Deleting the provider row that owned an image default needs no manual repair either: the next settings read or write drops the binding and candidate whose provider row is gone, so the Default image model row reports no default instead of a binding the runtime rejects. The explicit make-default actions and the edit path remain unchanged.
+- **Specs linked**: `03-runtime/13-model-catalog-and-selection.md`, `03-runtime/21-image-generation.md`
- **Acceptance**: B (model selection)
- **Milestone**: M6
- **Status**: Documented; covered by `apps/desktop/test/default-model-display.test.mjs`, `apps/desktop/test/image-generation-default.test.mjs`, `apps/desktop/test/provider-model-config.test.mjs`
diff --git a/docs/zh-CN/spec/03-runtime/21-image-generation.md b/docs/zh-CN/spec/03-runtime/21-image-generation.md
index f974813cf..52f63c879 100644
--- a/docs/zh-CN/spec/03-runtime/21-image-generation.md
+++ b/docs/zh-CN/spec/03-runtime/21-image-generation.md
@@ -2,7 +2,7 @@
> **翻译说明:** 本页对应 [英文源规格](/spec/03-runtime/21-image-generation)。代码、协议字段和标识符保持原文;如有歧义,以英文版本为准。
-桌面通过 `AppSettings.imageGeneration` 保存当前默认生图绑定,并通过可选的 `AppSettings.imageGenerationModels` 保存已标记的生图模型列表。缺省候选列表时兼容旧数据,把单绑定视为唯一候选;`providerId` 和 `modelId` 仍是每个绑定的字段。host-core 使用现有设置存储校验并持久化,无需数据库版本升级。每个候选独立于默认对话模型,引用已启用的 API-key 或免认证服务商及其已配置模型。
+桌面通过 `AppSettings.imageGeneration` 保存当前默认生图绑定,并通过可选的 `AppSettings.imageGenerationModels` 保存已标记的生图模型列表。缺省候选列表时兼容旧数据,把单绑定视为唯一候选;`providerId` 和 `modelId` 仍是每个绑定的字段。host-core 使用现有设置存储校验并持久化,无需数据库版本升级。引用不再对应任何服务商行的绑定不会被持久化:host-core 在每次设置读取和写入时丢弃该当前绑定与对应候选,与配置同步应用捆绑包时的引用规则一致,因此被删除的服务商不会留下运行时必须拒绝的默认值。每个候选独立于默认对话模型,引用已启用的 API-key 或免认证服务商及其已配置模型。
## 配置
@@ -10,7 +10,7 @@
或“服务已更新”,避免取消标记后仍声称“已设为生图模型”。
从生图摘要菜单选择默认模型时,仍显示生图选择成功提示。
-模型高级设置将“设为生图模型”与图片、文档附件能力放在同一能力组中,不再单独占一行;复选框支持多选,保存服务商表单后把所有勾选模型写入 `imageGenerationModels`,取消不会改变设置。保存候选不会替换默认对话模型。若当前默认生图模型所属服务商的生图勾选被全部取消,则清空该默认,即使其他服务商仍有可运行候选;模型页取消勾选,且不会自动改选其他候选。同一服务商仍保留其他生图勾选时,默认改到第一个可运行的已标记候选。取消标记的模型恢复为可选对话模型,重新打开设置后仍保持这一状态。保存其他服务商时保留仍可用的默认生图模型。默认模型下方同一面板中的“生图模型”显示当前默认,并提供菜单从所有已标记候选中选择一个。没有候选,或没有任何可选项时,隐藏摘要行。仍有其他可选候选时,已存在但服务商停用、缺少凭据或模型移除的当前默认仅显示“暂不可用”。OAuth 账户不适用,也不会自动回退。
+模型高级设置将“设为生图模型”与图片、文档附件能力放在同一能力组中,不再单独占一行;复选框支持多选,保存服务商表单后把所有勾选模型写入 `imageGenerationModels`,取消不会改变设置。保存候选不会替换默认对话模型。若当前默认生图模型所属服务商的生图勾选被全部取消,则清空该默认,即使其他服务商仍有可运行候选;模型页取消勾选,且不会自动改选其他候选。同一服务商仍保留其他生图勾选时,默认改到第一个可运行的已标记候选。取消标记的模型恢复为可选对话模型,重新打开设置后仍保持这一状态。保存其他服务商时保留仍可用的默认生图模型。默认模型下方同一面板中的“生图模型”显示当前默认,并提供菜单从所有已标记候选中选择一个。没有候选,或没有任何可选项时,隐藏摘要行。仍有其他可选候选时,服务商仍存在但已停用、缺少凭据或该模型已移除的候选仅显示“暂不可用”;服务商行已被删除的候选则在下次设置读取或写入时从存储列表中丢弃,不再继续列出。OAuth 账户不适用,也不会自动回退。
所有已标记的服务商/模型组合都会从默认对话模型选择器、服务商快速设为默认操作和 Composer 模型菜单中排除。其他服务商的同名模型独立保留。已有会话绑定和历史不改写;仍绑定任一生图候选的会话必须选择对话模型才能发送,运行时也会在推理前拒绝所有已标记生图模型。
### 移除服务商模型
@@ -18,7 +18,7 @@
在服务商编辑器中主动移除已配置模型并保存时,即使没有操作生图能力复选框,
也会清除该模型的生图候选。如果它是当前默认生图模型,则清空默认值,即使其他服务商仍有可用候选。取消编辑保留模型列表和生图设置。
旧版单绑定配置遵循相同规则。生图选择未改变时保留原有服务商保存流程。
-服务商的外部变化仍可能留下显示为“暂不可用”的绑定。
+服务商的外部变化仍可能留下显示为“暂不可用”的绑定,直到下一次设置读取或写入时丢弃服务商行已不存在的绑定。
若当前聊天默认模型也被移除,仍按原有规则选择服务商的第一个剩余模型;
否则保留聊天默认值。
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 33c210237..3779a0961 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -280,8 +280,8 @@ task-candidate E2E 从请求工作树运行,但使用主工作区已经准备
- **前提条件**:应用运行;提供商 A 已保存并设为应用默认模型;另有提供商 B 提供不同的模型;A 上配置了一个图片模型,另一家服务上也配置了一个。
- **步骤**:1) 打开设置 → 模型配置,新增提供商 B,保存时不动「默认模型」行。2) 确认「默认模型」行仍是提供商 A 与其确切模型,且新建会话使用它。3) 将某个图片模型设为默认画图模型,再新增一个同样提供图片模型的服务并保存。4) 确认「默认画图模型」行仍指向原绑定,而选择器的候选里出现新提供商的图片模型。5) 删除拥有默认值的那家提供商,再新增一个既提供对话模型又提供图片模型的服务并保存。6) 确认两个默认值此时都解析到新增的服务。
-- **预期**:新增提供商保存后不会改写仍然可解析的应用默认值:默认模型保留「默认模型」行已经展示的那对提供商/模型,默认画图模型保留其存储绑定,同时候选列表继续增长。只有已无法解析的默认值(提供商被删除,或其模型已从提供商移除)才会由新增的提供商填补,因此只有在应用否则将无从运行时才会写入设置。显式的「设为默认」操作、编辑路径,以及回落到首个剩余绑定的行为都不变。
-- **链接规格**:`03-runtime/13-model-catalog-and-selection.md`
+- **预期**:新增提供商保存后不会改写仍然可解析的应用默认值:默认模型保留「默认模型」行已经展示的那对提供商/模型,默认画图模型保留其存储绑定,同时候选列表继续增长。只有已无法解析的默认值(提供商被删除,或其模型已从提供商移除)才会由新增的提供商填补,因此只有在应用否则将无从运行时才会写入设置。删除拥有生图默认值的服务商行本身无需手工修复:下一次设置读取或写入会丢弃服务商行已不存在的绑定与候选,因此「默认画图模型」行显示为未设置,而不是运行时必须拒绝的绑定。显式的「设为默认」操作、编辑路径,以及回落到首个剩余绑定的行为都不变。
+- **链接规格**:`03-runtime/13-model-catalog-and-selection.md`、`03-runtime/21-image-generation.md`
- **接受**:B(模型选择)
- **里程碑**:M6
- **状态**:已文档化;由 `apps/desktop/test/default-model-display.test.mjs`、`apps/desktop/test/image-generation-default.test.mjs`、`apps/desktop/test/provider-model-config.test.mjs` 覆盖