From 22784bf421877d65e64fadb2de483306dc2469c2 Mon Sep 17 00:00:00 2001 From: hhs <386998068@qq.com> Date: Sat, 13 Jun 2026 15:38:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9A=E4=B9=89=20STT=20Service=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=88Recognize=20+=20Options=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/ai/stt/stt.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 backend/internal/ai/stt/stt.go diff --git a/backend/internal/ai/stt/stt.go b/backend/internal/ai/stt/stt.go new file mode 100644 index 0000000..33fe57b --- /dev/null +++ b/backend/internal/ai/stt/stt.go @@ -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" +}