Fix: remove extra whitespaces from stt transcription

This commit is contained in:
Grail Finder
2025-06-17 07:34:13 +03:00
parent 5a489211ef
commit e4b8a89f25

View File

@@ -103,7 +103,8 @@ func (stt *WhisperSTT) StopRecording() (string, error) {
} }
resptext := strings.TrimRight(string(responseTextBytes), "\n") resptext := strings.TrimRight(string(responseTextBytes), "\n")
// in case there are special tokens like [_BEG_] // in case there are special tokens like [_BEG_]
return specialRE.ReplaceAllString(resptext, ""), nil resptext = specialRE.ReplaceAllString(resptext, "")
return strings.TrimSpace(strings.ReplaceAll(resptext, "\n ", "\n")), nil
} }
func (stt *WhisperSTT) writeWavHeader(w io.Writer, dataSize int) { func (stt *WhisperSTT) writeWavHeader(w io.Writer, dataSize int) {