1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-09 17:29:54 +00:00

tags and caching

This commit is contained in:
Laura
2025-08-10 16:38:02 +02:00
parent 58d4e4b64b
commit dcf7f09108
9 changed files with 133 additions and 16 deletions

View File

@@ -4,13 +4,15 @@ import (
"context"
"sort"
"strings"
"github.com/revrost/go-openrouter"
)
type Model struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
SupportedParameters []string `json:"supported_parameters,omitempty"`
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Tags []string `json:"tags,omitempty"`
}
var ModelMap = make(map[string]*Model)
@@ -37,10 +39,10 @@ func LoadModels() ([]*Model, error) {
}
m := &Model{
ID: model.ID,
Name: name,
Description: model.Description,
SupportedParameters: model.SupportedParameters,
ID: model.ID,
Name: name,
Description: model.Description,
Tags: GetModelTags(model),
}
models[index] = m
@@ -50,3 +52,17 @@ func LoadModels() ([]*Model, error) {
return models, nil
}
func GetModelTags(model openrouter.Model) []string {
var tags []string
for _, parameter := range model.SupportedParameters {
if parameter == "reasoning" || parameter == "tools" {
tags = append(tags, parameter)
}
}
sort.Strings(tags)
return tags
}