返回 DeepSeek-Reasonix
reasoning_resolution.go
根目录 / internal / config / reasoning_resolution.go
1 package config
2
3 import "reasonix/internal/provider"
4
5 // ResolvedReasoningView is additive UI metadata, resolved by the same adapter
6 // contract as boot validation. Empty Effective means the server chooses.
7 type ResolvedReasoningView struct {
8 State string `json:"state,omitempty"`
9 APIFormat string `json:"apiFormat"`
10 Protocol string `json:"protocol"`
11 Selected string `json:"selected"`
12 Effective string `json:"effective,omitempty"`
13 Default string `json:"default,omitempty"`
14 Options []provider.ReasoningOption `json:"options"`
15 Error string `json:"error,omitempty"`
16 }
17
18 func ResolveReasoningView(e *ProviderEntry) *ResolvedReasoningView {
19 if e == nil {
20 return nil
21 }
22 cap := ReasoningCapabilityForEntry(e)
23 effort := EffectiveEffort(e)
24 out := &ResolvedReasoningView{APIFormat: e.Kind, Protocol: ReasoningProtocolForEntry(e), Selected: EffortDisplay(e), Effective: effort, Default: cap.Default, Options: cap.Options}
25 out.State = cap.State()
26 if err := cap.Validate(e.Model, effort); err != nil {
27 out.Error = err.Error()
28 }
29 if out.Effective == "" {
30 out.Effective = cap.Default
31 }
32 return out
33 }
34
34 lines GO