feat(voice-input): 改进音频消息处理,支持音频时长和指令文本,优化后端交互

This commit is contained in:
2026-09-28 09:33:57 +08:00
parent fff10a2e19
commit 306f2f7ff7
4 changed files with 301 additions and 159 deletions

View File

@@ -22,8 +22,19 @@ export const lang = {
// ====== ai-chat-message ======
aiNickname: 'AI Assistant',
defaultNickname: 'Me',
// PR-FRONTEND-VOICE-INPUT (2026-09-24): query text for attachment-only messages
// audioMessage / videoMessage: short label for the user-bubble filename fallback (still used by bubble template)
// *Instruction* keys: explicit directive sent to the AI as the query.
// Just a label gets ignored — the AI needs an explicit "please listen/look"
// to actually invoke STT/vision/file parsing on the attachment payload.
audioMessage: 'Voice Message',
videoMessage: 'Video Message',
audioInstruction: 'I sent a voice message. Please listen to it and reply.',
audioInstructionWithDuration: 'I sent a voice message ({seconds}s). Please listen to it and reply.',
imageInstruction: 'I sent an image. Please look at it and reply.',
videoInstruction: 'I sent a video. Please watch it and reply.',
fileInstruction: 'I sent a file. Please review it and reply.',
attachmentInstruction: 'I sent attachments. Please review them and reply.',
inputPlaceholder: 'Please enter your question...',
expandEditorTitle: 'Edit Content',
loadMoreHistory: 'Load more history',

View File

@@ -22,8 +22,18 @@ export const lang = {
// ====== ai-chat-message ======
aiNickname: '智能助手',
defaultNickname: '我',
// PR-FRONTEND-VOICE-INPUT (2026-09-24): 纯附件时发给后端的 query 文案
// audioMessage / videoMessage: 用户气泡里文件名的兜底 (短标签, 仍在 bubble 模板用)
// *Instruction* 系列: 纯附件时发给 AI 的 query, 显式要求 AI "去看/听" 附件内容
// AI 必须看到指令才会主动调 STT / 视觉 / 文件解析, 光有 label 容易被忽略
audioMessage: '语音消息',
videoMessage: '视频消息',
audioInstruction: '我发送了一段语音,请听一下并回复我',
audioInstructionWithDuration: '我发送了一段语音({seconds} 秒),请听一下并回复我',
imageInstruction: '我发送了一张图片,请查看图片内容并回复我',
videoInstruction: '我发送了一段视频,请查看视频内容并回复我',
fileInstruction: '我发送了一个文件,请查看文件内容并回复我',
attachmentInstruction: '我发送了附件,请查看附件内容并回复我',
inputPlaceholder: '请输入您的问题...',
expandEditorTitle: '编辑内容',
loadMoreHistory: '加载更多历史消息',