fix(opencode): preserve extra model fields during serialization

Add `extra` field with serde flatten to OpenCodeModel struct to capture
custom fields like cost, modalities, thinking, and variants that were
previously lost during save operations.
This commit is contained in:
Jason
2026-01-23 20:42:50 +08:00
parent d6cf4390ac
commit a6ad896db0
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -596,6 +596,11 @@ pub struct OpenCodeModel {
/// 模型额外选项(provider 路由等)
#[serde(skip_serializing_if = "Option::is_none")]
pub options: Option<HashMap<String, Value>>,
/// 额外字段(cost、modalities、thinking、variants 等)
/// 使用 flatten 捕获所有未明确定义的字段
#[serde(flatten, default, skip_serializing_if = "HashMap::is_empty")]
pub extra: HashMap<String, Value>,
}
/// OpenCode 模型限制