From c249dbcb17347e79d6bdc268159f6a42396399fd Mon Sep 17 00:00:00 2001 From: matevip Date: Fri, 24 Apr 2026 18:16:18 +0800 Subject: [PATCH] feat(llm): expose supportsReasoningEffort on ModelInfoDTO --- .../main/java/vip/mate/llm/model/ModelInfoDTO.java | 14 ++++++++++++++ .../vip/mate/llm/service/ModelProviderService.java | 2 ++ 2 files changed, 16 insertions(+) diff --git a/mateclaw-server/src/main/java/vip/mate/llm/model/ModelInfoDTO.java b/mateclaw-server/src/main/java/vip/mate/llm/model/ModelInfoDTO.java index 0c421ce8..e840068c 100644 --- a/mateclaw-server/src/main/java/vip/mate/llm/model/ModelInfoDTO.java +++ b/mateclaw-server/src/main/java/vip/mate/llm/model/ModelInfoDTO.java @@ -22,8 +22,22 @@ public class ModelInfoDTO { /** Reason text when probeOk=false (short, suitable for UI badge tooltip) */ private String probeError; + /** + * RFC-049 PR-1-UI: whether this model's {@code ModelFamily} accepts the + * {@code reasoning_effort} parameter. Derived from the model name on the + * server side so the frontend can gray out the "thinking depth" selector + * for chat-type models that don't support thinking — a product contract, + * not a runtime toggle. + * + *

{@code true} only for the OpenAI reasoning family (gpt-5*, o1*, o3*, o4*). + */ + private boolean supportsReasoningEffort; + public ModelInfoDTO(String id, String name) { this.id = id; this.name = name; + // RFC-049 PR-1-UI: derived from id (the model name) so every construction + // site populates the capability consistently. + this.supportsReasoningEffort = ModelFamily.detect(id).supportsReasoningEffort(); } } diff --git a/mateclaw-server/src/main/java/vip/mate/llm/service/ModelProviderService.java b/mateclaw-server/src/main/java/vip/mate/llm/service/ModelProviderService.java index 96c21718..8b148ad2 100644 --- a/mateclaw-server/src/main/java/vip/mate/llm/service/ModelProviderService.java +++ b/mateclaw-server/src/main/java/vip/mate/llm/service/ModelProviderService.java @@ -249,6 +249,8 @@ public class ModelProviderService { List extraModels = new ArrayList<>(); if (models != null) { for (ModelConfigEntity model : models) { + // RFC-049 PR-1-UI: ModelInfoDTO(id, name) derives supportsReasoningEffort + // from id via ModelFamily — no extra wiring needed here. ModelInfoDTO info = new ModelInfoDTO(model.getModelName(), model.getName()); if (Boolean.TRUE.equals(model.getBuiltin())) { builtinModels.add(info);