feat: 定义 STT Service 接口(Recognize + Options)
This commit is contained in:
16
backend/internal/ai/stt/stt.go
Normal file
16
backend/internal/ai/stt/stt.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package stt
|
||||
|
||||
import "context"
|
||||
|
||||
// Service 语音识别服务契约。
|
||||
type Service interface {
|
||||
// Recognize 识别一段完整音频,返回最终文本。
|
||||
Recognize(ctx context.Context, audio []byte, opts Options) (string, error)
|
||||
}
|
||||
|
||||
// Options 语音识别参数。
|
||||
type Options struct {
|
||||
Encoding string // 音频编码,如 "pcm_s16le"
|
||||
SampleRate int // 采样率,如 16000
|
||||
Language string // 语言,如 "zh-CN"
|
||||
}
|
||||
Reference in New Issue
Block a user