summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers_utils.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-26 20:19:41 +0300
committerPaul Buetow <paul@buetow.org>2025-09-26 20:19:41 +0300
commit1731126b52e406a300270c8fc8ac1061a4422b27 (patch)
treec74768df49994aa9676cbc69ebfb461ed0422e01 /internal/lsp/handlers_utils.go
parent0583b360ceb606b8e58f12a17f588bd27feeb117 (diff)
Refactor surface config to support multi-provider arrays
Diffstat (limited to 'internal/lsp/handlers_utils.go')
-rw-r--r--internal/lsp/handlers_utils.go38
1 files changed, 18 insertions, 20 deletions
diff --git a/internal/lsp/handlers_utils.go b/internal/lsp/handlers_utils.go
index 3bd13ee..c8d2d24 100644
--- a/internal/lsp/handlers_utils.go
+++ b/internal/lsp/handlers_utils.go
@@ -81,43 +81,41 @@ func resolveDefaultModel(cfg appconfig.App, provider string) string {
}
}
-func surfaceModelFromConfig(cfg appconfig.App, surface surfaceKind) string {
+func surfaceConfigsFor(cfg appconfig.App, surface surfaceKind) []appconfig.SurfaceConfig {
switch surface {
case surfaceCompletion:
- return cfg.CompletionModel
+ return cfg.CompletionConfigs
case surfaceCodeAction:
- return cfg.CodeActionModel
+ return cfg.CodeActionConfigs
case surfaceChat:
- return cfg.ChatModel
+ return cfg.ChatConfigs
default:
+ return nil
+ }
+}
+
+func surfaceModelFromConfig(cfg appconfig.App, surface surfaceKind) string {
+ configs := surfaceConfigsFor(cfg, surface)
+ if len(configs) == 0 {
return ""
}
+ return configs[0].Model
}
func surfaceProviderFromConfig(cfg appconfig.App, surface surfaceKind) string {
- switch surface {
- case surfaceCompletion:
- return cfg.CompletionProvider
- case surfaceCodeAction:
- return cfg.CodeActionProvider
- case surfaceChat:
- return cfg.ChatProvider
- default:
+ configs := surfaceConfigsFor(cfg, surface)
+ if len(configs) == 0 {
return ""
}
+ return configs[0].Provider
}
func surfaceTemperatureFromConfig(cfg appconfig.App, surface surfaceKind) *float64 {
- switch surface {
- case surfaceCompletion:
- return cfg.CompletionTemperature
- case surfaceCodeAction:
- return cfg.CodeActionTemperature
- case surfaceChat:
- return cfg.ChatTemperature
- default:
+ configs := surfaceConfigsFor(cfg, surface)
+ if len(configs) == 0 {
return nil
}
+ return configs[0].Temperature
}
func chooseSurfaceTemperature(surface surfaceKind, cfg appconfig.App, provider string, overrideModel, fallbackModel string) (float64, bool) {