Chore: panic is not solved (WIP)

This commit is contained in:
Grail Finder
2026-03-07 09:40:58 +03:00
parent 118a0a0d55
commit 2c495253c2
2 changed files with 7 additions and 0 deletions

2
bot.go
View File

@@ -418,7 +418,9 @@ func fetchLCPModelsWithStatus() (*models.LCPModels, error) {
if err := json.NewDecoder(resp.Body).Decode(data); err != nil {
return nil, err
}
localModelsMu.Lock()
localModelsData = data
localModelsMu.Unlock()
return data, nil
}

View File

@@ -99,6 +99,11 @@ func (o *KokoroONNXOrator) ensureInitialized(modelPath string) error {
} else {
// Shape is (510, 1, 256), we want the last 256 values (or first? let's use mean or just pick one)
// Actually, let's average across all 510 to get a single 256-dim vector
if len(styleVec) != 510*256 {
o.logger.Error("voice embedding has unexpected size", "len", len(styleVec))
err = fmt.Errorf("voice embedding has unexpected size", "len", len(styleVec))
return err
}
o.styleVector = make([]float32, 256)
for i := 0; i < 256; i++ {
var sum float32