From b9a66248d8fd88644f1fec3f8be35fbbc23d4803 Mon Sep 17 00:00:00 2001 From: kernoeb Date: Sun, 22 Feb 2026 01:32:44 +0100 Subject: [PATCH] fix: resolve Groq STT key from model_list when providers.groq is absent (#602) When users migrate from the legacy `providers` config to the new `model_list` format, voice transcription silently breaks on Telegram, Discord and Slack channels. The gateway was reading the Groq API key exclusively from `cfg.Providers.Groq.APIKey`, which is empty once the key is defined only inside a `model_list` entry. The transcriber was never initialized, so voice messages fell back to a plain `[voice]` placeholder. This fix also scans `model_list` for any entry whose `model` field starts with `groq/` and uses its `api_key` as a fallback, preserving full backward compatibility with the legacy `providers.groq` field. --- cmd/picoclaw/cmd_gateway.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/picoclaw/cmd_gateway.go b/cmd/picoclaw/cmd_gateway.go index 9a3b6aa19..28ef76ad3 100644 --- a/cmd/picoclaw/cmd_gateway.go +++ b/cmd/picoclaw/cmd_gateway.go @@ -10,6 +10,7 @@ import ( "os" "os/signal" "path/filepath" + "strings" "time" "github.com/sipeed/picoclaw/pkg/agent" @@ -121,8 +122,17 @@ func gatewayCmd() { agentLoop.SetChannelManager(channelManager) var transcriber *voice.GroqTranscriber - if cfg.Providers.Groq.APIKey != "" { - transcriber = voice.NewGroqTranscriber(cfg.Providers.Groq.APIKey) + groqAPIKey := cfg.Providers.Groq.APIKey + if groqAPIKey == "" { + for _, mc := range cfg.ModelList { + if strings.HasPrefix(mc.Model, "groq/") && mc.APIKey != "" { + groqAPIKey = mc.APIKey + break + } + } + } + if groqAPIKey != "" { + transcriber = voice.NewGroqTranscriber(groqAPIKey) logger.InfoC("voice", "Groq voice transcription enabled") }