From f161a14877dfc6f65298fd6893b0b84b84c0ca31 Mon Sep 17 00:00:00 2001 From: Huaaudio Date: Sat, 21 Mar 2026 08:46:51 +0100 Subject: [PATCH] make fmt --- pkg/asr/asr.go | 16 +++++++++++++--- pkg/channels/discord/voice.go | 1 + pkg/voice/agent.go | 4 +++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/pkg/asr/asr.go b/pkg/asr/asr.go index b603383dc..0bd98ae71 100644 --- a/pkg/asr/asr.go +++ b/pkg/asr/asr.go @@ -48,7 +48,11 @@ func NewGroqTranscriber(apiKey string) *GroqTranscriber { } } -func (t *GroqTranscriber) TranscribeData(ctx context.Context, data []byte, filename string) (*TranscriptionResponse, error) { +func (t *GroqTranscriber) TranscribeData( + ctx context.Context, + data []byte, + filename string, +) (*TranscriptionResponse, error) { logger.InfoCF("voice", "Starting memory transcription", map[string]any{"filename": filename, "bytes": len(data)}) var requestBody bytes.Buffer @@ -111,7 +115,12 @@ func (t *GroqTranscriber) Transcribe(ctx context.Context, audioFilePath string) return t.doRequest(ctx, &requestBody, writer.FormDataContentType(), fileInfo.Size()) } -func (t *GroqTranscriber) doRequest(ctx context.Context, requestBody *bytes.Buffer, contentType string, fileSize int64) (*TranscriptionResponse, error) { +func (t *GroqTranscriber) doRequest( + ctx context.Context, + requestBody *bytes.Buffer, + contentType string, + fileSize int64, +) (*TranscriptionResponse, error) { url := t.apiBase + "/audio/transcriptions" req, err := http.NewRequestWithContext(ctx, "POST", url, requestBody) if err != nil { @@ -193,7 +202,8 @@ func DetectTranscriber(cfg *config.Config) Transcriber { } // Fall back to any model-list entry that uses the groq/ protocol. for _, mc := range cfg.ModelList { - if (strings.HasPrefix(mc.Model, "groq/") || mc.ModelName == "groq" || mc.Model == "whisper-large-v3-turbo") && mc.APIKey != "" { + if (strings.HasPrefix(mc.Model, "groq/") || mc.ModelName == "groq" || mc.Model == "whisper-large-v3-turbo") && + mc.APIKey != "" { return NewGroqTranscriber(mc.APIKey) } } diff --git a/pkg/channels/discord/voice.go b/pkg/channels/discord/voice.go index 4c37e952f..7a6be5e7c 100644 --- a/pkg/channels/discord/voice.go +++ b/pkg/channels/discord/voice.go @@ -8,6 +8,7 @@ import ( "time" "github.com/bwmarrin/discordgo" + "github.com/sipeed/picoclaw/pkg/bus" "github.com/sipeed/picoclaw/pkg/logger" ) diff --git a/pkg/voice/agent.go b/pkg/voice/agent.go index 6a330d3d4..5ab19bc01 100644 --- a/pkg/voice/agent.go +++ b/pkg/voice/agent.go @@ -11,6 +11,7 @@ import ( "github.com/pion/rtp" "github.com/pion/webrtc/v3/pkg/media/oggwriter" + "github.com/sipeed/picoclaw/pkg/asr" "github.com/sipeed/picoclaw/pkg/bus" "github.com/sipeed/picoclaw/pkg/logger" @@ -187,7 +188,8 @@ func (a *Agent) processUtterance(ctx context.Context, acc *speechAccumulator) { channelType := "discord" text := strings.ToLower(strings.TrimSpace(res.Text)) - if strings.Contains(text, "leave the voice channel") || strings.Contains(text, "leave voice") || strings.Contains(text, "disconnect voice") { + if strings.Contains(text, "leave the voice channel") || strings.Contains(text, "leave voice") || + strings.Contains(text, "disconnect voice") { logger.InfoCF("voice-agent", "Voice command triggered: leave", nil) a.bus.PublishVoiceControl(ctx, bus.VoiceControl{ SessionID: acc.sessionID,