From 2246df9d094ea9e82cf07c3515767f5bcc3e4dfe Mon Sep 17 00:00:00 2001 From: matevip Date: Sat, 2 May 2026 15:42:04 +0800 Subject: [PATCH] fix(agent): allow PUT modelName=null to revert to global default --- .../src/main/java/vip/mate/agent/model/AgentEntity.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mateclaw-server/src/main/java/vip/mate/agent/model/AgentEntity.java b/mateclaw-server/src/main/java/vip/mate/agent/model/AgentEntity.java index cda34962..0654f451 100644 --- a/mateclaw-server/src/main/java/vip/mate/agent/model/AgentEntity.java +++ b/mateclaw-server/src/main/java/vip/mate/agent/model/AgentEntity.java @@ -44,9 +44,17 @@ public class AgentEntity { * or disabled also fall back, since {@code resolveModel} returns the * default when no enabled match is found. * + *

{@link FieldStrategy#ALWAYS} so a {@code PUT} with explicit null + * actually clears the column — the MyBatis-Plus default {@code NOT_NULL} + * strategy silently drops null fields from UPDATE, which means a user + * who once picked a model could never revert back to "use global default" + * via the UI (only by directly editing the DB). Smoke test on 2026-05-02 + * caught it. + * *

RFC-03 Lane G1 — re-enables this field after it was silently * deprecated in earlier work; the database column is unchanged. */ + @TableField(value = "model_name", updateStrategy = FieldStrategy.ALWAYS) private String modelName; /** 最大迭代次数 */