Feat: token use estimation

This commit is contained in:
Grail Finder
2026-03-02 14:54:20 +03:00
parent 8458edf5a8
commit fcc71987bf
2 changed files with 80 additions and 1 deletions

6
bot.go
View File

@@ -63,7 +63,9 @@ var (
"google/gemma-3-27b-it:free",
"meta-llama/llama-3.3-70b-instruct:free",
}
LocalModels = []string{}
LocalModels = []string{}
localModelsData *models.LCPModels
orModelsData *models.ORModels
)
var thinkBlockRE = regexp.MustCompile(`(?s)<think>.*?</think>`)
@@ -355,6 +357,7 @@ func fetchORModels(free bool) ([]string, error) {
if err := json.NewDecoder(resp.Body).Decode(data); err != nil {
return nil, err
}
orModelsData = data
freeModels := data.ListModels(free)
return freeModels, nil
}
@@ -416,6 +419,7 @@ func fetchLCPModelsWithStatus() (*models.LCPModels, error) {
if err := json.NewDecoder(resp.Body).Decode(data); err != nil {
return nil, err
}
localModelsData = data
return data, nil
}