feat(llm): expose supportsReasoningEffort on ModelInfoDTO

This commit is contained in:
matevip 2026-04-24 18:16:18 +08:00
parent 84370566de
commit c249dbcb17
2 changed files with 16 additions and 0 deletions

View File

@ -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.
*
* <p>{@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();
}
}

View File

@ -249,6 +249,8 @@ public class ModelProviderService {
List<ModelInfoDTO> 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);