summaryrefslogtreecommitdiff
path: root/internal/appconfig
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-20 18:27:35 +0300
committerPaul Buetow <paul@buetow.org>2026-05-20 18:27:35 +0300
commit83caeb9bcdc4a5eafda937807cd42ea8455948a6 (patch)
treef2258d2d77bfb3f9186bbc457cecdfe17877b891 /internal/appconfig
parent005c262d09314cd43285af33dc6f1afef0621714 (diff)
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 <amp@ampcode.com>
Diffstat (limited to 'internal/appconfig')
-rw-r--r--internal/appconfig/app_sections.go2
-rw-r--r--internal/appconfig/config_env.go2
-rw-r--r--internal/appconfig/config_load.go12
-rw-r--r--internal/appconfig/config_merge.go3
-rw-r--r--internal/appconfig/config_types.go5
5 files changed, 24 insertions, 0 deletions
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"`