feat(watcher): add Gemini models and OAuth model mappings change detection

This commit is contained in:
hkfires
2025-12-30 22:13:42 +08:00
parent e947266743
commit 2c01b2ef64
5 changed files with 150 additions and 0 deletions

View File

@@ -122,6 +122,11 @@ type VertexModelsSummary struct {
count int
}
type GeminiModelsSummary struct {
hash string
count int
}
// SummarizeVertexModels hashes vertex-compatible models for change detection.
func SummarizeVertexModels(models []config.VertexCompatModel) VertexModelsSummary {
if len(models) == 0 {
@@ -149,3 +154,24 @@ func SummarizeVertexModels(models []config.VertexCompatModel) VertexModelsSummar
count: len(names),
}
}
// SummarizeGeminiModels hashes Gemini model aliases for change detection.
func SummarizeGeminiModels(models []config.GeminiModel) GeminiModelsSummary {
if len(models) == 0 {
return GeminiModelsSummary{}
}
keys := normalizeModelPairs(func(out func(key string)) {
for _, model := range models {
name := strings.TrimSpace(model.Name)
alias := strings.TrimSpace(model.Alias)
if name == "" && alias == "" {
continue
}
out(strings.ToLower(name) + "|" + strings.ToLower(alias))
}
})
return GeminiModelsSummary{
hash: hashJoined(keys),
count: len(keys),
}
}