From ed4a49c8ae786aa99e3cf4b591df22ea0e986e46 Mon Sep 17 00:00:00 2001 From: wujian <87390231@qq.com> Date: Fri, 6 Mar 2026 19:31:06 +0800 Subject: [PATCH] voice function support qwen mod --- core/speech.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/speech.go b/core/speech.go index 23538e7..42c0ab1 100644 --- a/core/speech.go +++ b/core/speech.go @@ -207,8 +207,17 @@ func ConvertAudioToMP3(audio []byte, srcFormat string) ([]byte, error) { return nil, fmt.Errorf("ffmpeg not found in PATH: install ffmpeg to enable voice message support") } - var cmd *exec.Cmd - if srcFormat == "amr" || srcFormat == "silk" { + cmd := exec.Command(ffmpegPath, + "-i", "pipe:0", + "-f", srcFormat, + "-f", "mp3", + "-ac", "1", + "-ar", "16000", + "-y", + "pipe:1", + ) + // For formats where ffmpeg can't auto-detect from pipe, specify input format + if srcFormat == "amr" || srcFormat == "silk" { cmd = exec.Command(ffmpegPath, "-f", srcFormat, "-i", "pipe:0",