feat: STT 敏感文本降级为 Debug 并截断保护
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/hhs/camtalk/internal/ai/stt"
|
"github.com/hhs/camtalk/internal/ai/stt"
|
||||||
"github.com/hhs/camtalk/internal/logger"
|
"github.com/hhs/camtalk/internal/logger"
|
||||||
"github.com/hhs/camtalk/internal/models"
|
"github.com/hhs/camtalk/internal/models"
|
||||||
|
"github.com/hhs/camtalk/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewSTTLambda 创建 STT Lambda 节点。
|
// NewSTTLambda 创建 STT Lambda 节点。
|
||||||
@@ -39,8 +40,10 @@ func NewSTTLambda(sttService stt.Service) *compose.Lambda {
|
|||||||
|
|
||||||
// 文本输入模式:跳过 STT
|
// 文本输入模式:跳过 STT
|
||||||
if input.Text != "" {
|
if input.Text != "" {
|
||||||
log.Infow("使用文本输入,跳过 STT",
|
log.Debugw("text input mode, skipping stt",
|
||||||
"request_id", requestID, "text", input.Text)
|
"request_id", requestID,
|
||||||
|
"text_len", len(input.Text),
|
||||||
|
"text_preview", util.Truncate(input.Text, 50))
|
||||||
|
|
||||||
// 发送 stt_result 保持前端消息流一致性
|
// 发送 stt_result 保持前端消息流一致性
|
||||||
if sender != nil {
|
if sender != nil {
|
||||||
@@ -101,7 +104,10 @@ func NewSTTLambda(sttService stt.Service) *compose.Lambda {
|
|||||||
text = "(未识别到语音)"
|
text = "(未识别到语音)"
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infow("语音识别完成", "request_id", requestID, "text", text)
|
log.Debugw("stt recognition completed",
|
||||||
|
"request_id", requestID,
|
||||||
|
"text_len", len(text),
|
||||||
|
"text_preview", util.Truncate(text, 50))
|
||||||
|
|
||||||
// 发送 stt_result
|
// 发送 stt_result
|
||||||
if sender != nil {
|
if sender != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user