From 83caeb9bcdc4a5eafda937807cd42ea8455948a6 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 20 May 2026 18:27:35 +0300 Subject: Add YouSearch (You.com Research API) provider integration Amp-Thread-ID: https://ampcode.com/threads/T-019e45ff-4976-750c-b2e6-121d0e5991ef Co-authored-by: Amp --- internal/appconfig/app_sections.go | 2 ++ internal/appconfig/config_env.go | 2 ++ internal/appconfig/config_load.go | 12 ++++++++++++ internal/appconfig/config_merge.go | 3 +++ internal/appconfig/config_types.go | 5 +++++ 5 files changed, 24 insertions(+) (limited to 'internal/appconfig') diff --git a/internal/appconfig/app_sections.go b/internal/appconfig/app_sections.go index 6dd60c6..05b3171 100644 --- a/internal/appconfig/app_sections.go +++ b/internal/appconfig/app_sections.go @@ -57,6 +57,8 @@ type ProviderConfig struct { AnthropicModel string `json:"anthropic_model"` // Default temperature for Anthropic requests (nil means use provider default) AnthropicTemperature *float64 `json:"anthropic_temperature"` + // YouSearch options + YouSearchResearchEffort string `json:"yousearch_research_effort"` // lite|standard|deep|exhaustive // Per-surface provider/model configurations (ordered; first entry is primary) CompletionConfigs []SurfaceConfig `json:"-"` CodeActionConfigs []SurfaceConfig `json:"-"` diff --git a/internal/appconfig/config_env.go b/internal/appconfig/config_env.go index 5f576e0..9834183 100644 --- a/internal/appconfig/config_env.go +++ b/internal/appconfig/config_env.go @@ -75,6 +75,8 @@ func applyProviderEnv(out *App, logger *log.Logger) bool { any = true } any = applyEnvFloat(&out.AnthropicTemperature, "HEXAI_ANTHROPIC_TEMPERATURE", logger) || any + + any = applyEnvString(&out.YouSearchResearchEffort, "HEXAI_YOUSEARCH_RESEARCH_EFFORT") || any return any } diff --git a/internal/appconfig/config_load.go b/internal/appconfig/config_load.go index aa169bc..3ed1654 100644 --- a/internal/appconfig/config_load.go +++ b/internal/appconfig/config_load.go @@ -205,6 +205,7 @@ func rejectLegacyKeys(raw map[string]any) error { knownTables := map[string]struct{}{ "general": {}, "logging": {}, "completion": {}, "triggers": {}, "inline": {}, "chat": {}, "provider": {}, "models": {}, "openai": {}, "ollama": {}, "prompts": {}, + "yousearch": {}, } for k := range raw { if _, isTable := knownTables[k]; isTable { @@ -269,6 +270,7 @@ func applyProviderSections(fc *fileConfig, out *App) { applyOpenRouterSection(fc, out) applyOllamaSection(fc, out) applyAnthropicSection(fc, out) + applyYouSearchSection(fc, out) } func applyPromptSections(fc *fileConfig, out *App) { @@ -430,6 +432,16 @@ func applyAnthropicSection(fc *fileConfig, out *App) { out.mergeProviderFields(&tmp) } +func applyYouSearchSection(fc *fileConfig, out *App) { + if fc.YouSearch == (sectionYouSearch{}) { + return + } + tmp := App{ProviderConfig: ProviderConfig{ + YouSearchResearchEffort: fc.YouSearch.ResearchEffort, + }} + out.mergeProviderFields(&tmp) +} + func applyPromptCompletion(fc *fileConfig, out *App) { if fc.Prompts.Completion == (sectionPromptsCompletion{}) { return diff --git a/internal/appconfig/config_merge.go b/internal/appconfig/config_merge.go index 7a99c94..f3557c1 100644 --- a/internal/appconfig/config_merge.go +++ b/internal/appconfig/config_merge.go @@ -141,6 +141,9 @@ func (a *App) mergeProviderFields(other *App) { if other.AnthropicTemperature != nil { // allow explicit 0.0 a.AnthropicTemperature = other.AnthropicTemperature } + if s := strings.TrimSpace(other.YouSearchResearchEffort); s != "" { + a.YouSearchResearchEffort = s + } } // mergeSurfaceModels copies per-surface model and temperature overrides. diff --git a/internal/appconfig/config_types.go b/internal/appconfig/config_types.go index 5c6cf0c..8d50f35 100644 --- a/internal/appconfig/config_types.go +++ b/internal/appconfig/config_types.go @@ -163,6 +163,7 @@ type fileConfig struct { OpenRouter sectionOpenRouter `toml:"openrouter"` Ollama sectionOllama `toml:"ollama"` Anthropic sectionAnthropic `toml:"anthropic"` + YouSearch sectionYouSearch `toml:"yousearch"` Prompts sectionPrompts `toml:"prompts"` Tmux sectionTmux `toml:"tmux"` Stats sectionStats `toml:"stats"` @@ -305,6 +306,10 @@ type sectionAnthropic struct { Temperature *float64 `toml:"temperature"` } +type sectionYouSearch struct { + ResearchEffort string `toml:"research_effort"` // lite|standard|deep|exhaustive +} + // Prompts sections type sectionPrompts struct { Completion sectionPromptsCompletion `toml:"completion"` -- cgit v1.2.3