Chore: fix linter complaints

This commit is contained in:
Grail Finder
2025-10-21 10:44:07 +03:00
parent 6a8e854ef6
commit 428c45da16
6 changed files with 35 additions and 36 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"gf-lt/config"
"gf-lt/extra"
"gf-lt/models"
"regexp"
@@ -82,29 +81,29 @@ After that you are free to respond to the user.
sysLabels = []string{"basic_sys", "tool_sys"}
)
func populateTools(cfg config.Config) {
// if we have access to some server with funcs we can populate funcs (tools|toolbelt?) with it
// there must be a better way
if cfg.SearchAPI == "" || cfg.SearchDescribe == "" {
return
}
resp, err := httpClient.Get(cfg.SearchDescribe)
if err != nil {
logger.Error("failed to get websearch tool description",
"link", cfg.SearchDescribe, "error", err)
return
}
descResp := models.Tool{}
if err := json.NewDecoder(resp.Body).Decode(&descResp); err != nil {
logger.Error("failed to unmarshal websearch tool description",
"link", cfg.SearchDescribe, "error", err)
return
}
fnMap["web_search"] = websearch
baseTools = append(baseTools, descResp)
logger.Info("added web_search tool", "tool", descResp)
return
}
// func populateTools(cfg config.Config) {
// // if we have access to some server with funcs we can populate funcs (tools|toolbelt?) with it
// // there must be a better way
// if cfg.SearchAPI == "" || cfg.SearchDescribe == "" {
// return
// }
// resp, err := httpClient.Get(cfg.SearchDescribe)
// if err != nil {
// logger.Error("failed to get websearch tool description",
// "link", cfg.SearchDescribe, "error", err)
// return
// }
// defer resp.Body.Close()
// descResp := models.Tool{}
// if err := json.NewDecoder(resp.Body).Decode(&descResp); err != nil {
// logger.Error("failed to unmarshal websearch tool description",
// "link", cfg.SearchDescribe, "error", err)
// return
// }
// fnMap["web_search"] = websearch
// baseTools = append(baseTools, descResp)
// logger.Info("added web_search tool", "tool", descResp)
// }
// {"type":"function","function":{"name":"web_search","description":"Perform a web search to find information on varioust topics","parameters":{"type":"object","properties":{"num_results":{"type":"integer","description":"Maximum number of results to return (default: 10)"},"query":{"type":"string","description":"The search query to find information about"},"search_type":{"type":"string","description":"Type of search to perform: 'api' for SearXNG API search or 'scraper' for web scraping (default: 'scraper')"}},"required":["query"]}}}