feat(assets): add ASR test audio file and embed it in the application

- Introduced a new audio file, asr_test.wav, for ASR testing purposes.
- Created embed.go to embed the ASR test audio file as a byte slice.
- Updated initialization.go to utilize the embedded ASR test audio for model transcription checks.
This commit is contained in:
wizardchen
2026-04-02 21:06:21 +08:00
committed by lyingbug
parent c93f4e94ae
commit 4ea58bc6f3
3 changed files with 8 additions and 5 deletions
+6
View File
@@ -0,0 +1,6 @@
package assets
import _ "embed"
//go:embed asr_test.wav
var ASRTestWAV []byte
+2 -5
View File
@@ -2,7 +2,6 @@ package handler
import (
"context"
_ "embed"
"encoding/json"
"fmt"
"io"
@@ -15,6 +14,7 @@ import (
"time"
chatpipeline "github.com/Tencent/WeKnora/internal/application/service/chat_pipeline"
"github.com/Tencent/WeKnora/internal/assets"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/errors"
"github.com/Tencent/WeKnora/internal/logger"
@@ -31,9 +31,6 @@ import (
"github.com/ollama/ollama/api"
)
//go:embed testdata/asr_test.wav
var asrTestWAV []byte
// DownloadTask 下载任务信息
type DownloadTask struct {
ID string `json:"id"`
@@ -1848,7 +1845,7 @@ func (h *InitializationHandler) CheckASRModel(c *gin.Context) {
return
}
text, err := asrInstance.Transcribe(ctx, asrTestWAV, "asr_test.wav")
text, err := asrInstance.Transcribe(ctx, assets.ASRTestWAV, "asr_test.wav")
available := true
message := "ASR连接成功"