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:
@@ -0,0 +1,6 @@
|
|||||||
|
package assets
|
||||||
|
|
||||||
|
import _ "embed"
|
||||||
|
|
||||||
|
//go:embed asr_test.wav
|
||||||
|
var ASRTestWAV []byte
|
||||||
@@ -2,7 +2,6 @@ package handler
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
_ "embed"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@@ -15,6 +14,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
chatpipeline "github.com/Tencent/WeKnora/internal/application/service/chat_pipeline"
|
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/config"
|
||||||
"github.com/Tencent/WeKnora/internal/errors"
|
"github.com/Tencent/WeKnora/internal/errors"
|
||||||
"github.com/Tencent/WeKnora/internal/logger"
|
"github.com/Tencent/WeKnora/internal/logger"
|
||||||
@@ -31,9 +31,6 @@ import (
|
|||||||
"github.com/ollama/ollama/api"
|
"github.com/ollama/ollama/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed testdata/asr_test.wav
|
|
||||||
var asrTestWAV []byte
|
|
||||||
|
|
||||||
// DownloadTask 下载任务信息
|
// DownloadTask 下载任务信息
|
||||||
type DownloadTask struct {
|
type DownloadTask struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
@@ -1848,7 +1845,7 @@ func (h *InitializationHandler) CheckASRModel(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
text, err := asrInstance.Transcribe(ctx, asrTestWAV, "asr_test.wav")
|
text, err := asrInstance.Transcribe(ctx, assets.ASRTestWAV, "asr_test.wav")
|
||||||
available := true
|
available := true
|
||||||
message := "ASR连接成功"
|
message := "ASR连接成功"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user