diff options
Diffstat (limited to 'src/tui_selectors.zig')
| -rw-r--r-- | src/tui_selectors.zig | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tui_selectors.zig b/src/tui_selectors.zig index a37acb8..590d321 100644 --- a/src/tui_selectors.zig +++ b/src/tui_selectors.zig @@ -48,7 +48,10 @@ pub const ReasoningOption = struct { detail: []const u8, value: Value, - pub const Value = union(APIStyle) { + /// Two payload families, decoupled from `APIStyle`: `openai_chat` carries + /// a `reasoning` effort (shared by the `openai_chat` and `openai_responses` + /// styles), `anthropic_messages` carries a thinking selection. + pub const Value = union(enum) { /// OpenAI `reasoning` enum value. openai_chat: ReasoningEffort, /// Anthropic thinking selection: either disabled, or adaptive at an @@ -85,7 +88,8 @@ pub const ReasoningOption = struct { /// The reasoning options offered for a provider config's API style. pub fn forStyle(style: APIStyle) []const ReasoningOption { return switch (style) { - .openai_chat => &openai, + // The Responses style takes the same reasoning-effort options. + .openai_chat, .openai_responses => &openai, .anthropic_messages => &anthropic, }; } @@ -95,6 +99,7 @@ pub const ReasoningOption = struct { switch (self.value) { .openai_chat => |r| switch (cfg.*) { .openai_chat => |*c| c.reasoning = r, + .openai_responses => |*c| c.reasoning = r, .anthropic_messages => {}, }, .anthropic_messages => |sel| switch (cfg.*) { @@ -105,7 +110,7 @@ pub const ReasoningOption = struct { c.effort = e; }, }, - .openai_chat => {}, + .openai_chat, .openai_responses => {}, }, } } @@ -114,7 +119,8 @@ pub const ReasoningOption = struct { /// preselect the picker on the active value). pub fn matches(self: ReasoningOption, cfg: ProviderConfig) bool { switch (self.value) { - .openai_chat => |r| return cfg == .openai_chat and cfg.openai_chat.reasoning == r, + .openai_chat => |r| return (cfg == .openai_chat and cfg.openai_chat.reasoning == r) or + (cfg == .openai_responses and cfg.openai_responses.reasoning == r), .anthropic_messages => |sel| { if (cfg != .anthropic_messages) return false; const c = cfg.anthropic_messages; @@ -167,7 +173,7 @@ pub fn adaptiveFallback(cfg: *ProviderConfig) bool { c.thinking_budget_tokens = budget; return true; }, - .openai_chat => return false, + .openai_chat, .openai_responses => return false, } } |
