Changeset 0.13.1 (#65)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
@@ -22,6 +24,7 @@ import (
|
||||
"git.gobha.me/xcaliber/chat-switchboard/store"
|
||||
postgres "git.gobha.me/xcaliber/chat-switchboard/store/postgres"
|
||||
_ "git.gobha.me/xcaliber/chat-switchboard/tools" // registers built-in tools via init()
|
||||
"git.gobha.me/xcaliber/chat-switchboard/tools/search"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -89,6 +92,9 @@ func main() {
|
||||
|
||||
// Seed builtin extensions from disk (idempotent, version-aware)
|
||||
handlers.SeedBuiltinExtensions(stores, "extensions/builtin")
|
||||
|
||||
// Load search provider config from DB (defaults to DuckDuckGo if not set)
|
||||
loadSearchConfig(stores)
|
||||
}
|
||||
defer database.Close()
|
||||
|
||||
@@ -226,6 +232,7 @@ func main() {
|
||||
// Chat Completions
|
||||
comp := handlers.NewCompletionHandler(keyResolver, stores, hub, objStore)
|
||||
protected.POST("/chat/completions", comp.Complete)
|
||||
protected.GET("/tools", comp.ListTools)
|
||||
|
||||
// Summarize & Continue
|
||||
summarize := handlers.NewSummarizeHandler(stores, roleResolver)
|
||||
@@ -475,6 +482,25 @@ func main() {
|
||||
|
||||
// ── Vault CLI Commands ──────────────────────
|
||||
|
||||
// loadSearchConfig reads search provider config from global_config and applies it.
|
||||
// Falls back to DuckDuckGo (the default set in search package init) if not configured.
|
||||
func loadSearchConfig(stores store.Stores) {
|
||||
raw, err := stores.GlobalConfig.Get(context.Background(), "search_config")
|
||||
if err != nil || raw == nil {
|
||||
log.Println("🔍 Search: using default provider (DuckDuckGo)")
|
||||
return
|
||||
}
|
||||
b, _ := json.Marshal(raw)
|
||||
var cfg search.Config
|
||||
if err := json.Unmarshal(b, &cfg); err != nil {
|
||||
log.Printf("⚠️ Failed to parse search config: %v", err)
|
||||
return
|
||||
}
|
||||
if err := search.ApplyConfig(cfg); err != nil {
|
||||
log.Printf("⚠️ Failed to apply search config: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func runVaultCommand(subcmd string) {
|
||||
cfg := config.Load()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user