feat(ai-chat): 动态切换输入框 placeholder 文案,支持语音和媒体附件提示
This commit is contained in:
@@ -152,6 +152,11 @@ export const lang = {
|
||||
releaseToSend: 'Release to send',
|
||||
releaseToCancel: 'Release to cancel',
|
||||
slideUpToCancel: '↑ Slide up to cancel',
|
||||
slideUpToCancelHint: '↑ Slide up to cancel',
|
||||
// PR-INPUT-PLACEHOLDER-DYNAMIC (2026-09-28): dynamic input placeholder by context
|
||||
placeholderDefault: 'Type a message or hold to talk',
|
||||
placeholderWithAudio: 'Add a note for your voice (optional)',
|
||||
placeholderWithMedia: 'Add a caption (optional)',
|
||||
slideUpToCancelHint: '↑ Release to cancel',
|
||||
voiceStartFailed: 'Cannot start recording',
|
||||
voiceStopFailed: 'Recording failed, please try again',
|
||||
|
||||
@@ -152,6 +152,11 @@ export const lang = {
|
||||
releaseToCancel: '松开取消',
|
||||
slideUpToCancel: '↑ 上滑取消',
|
||||
slideUpToCancelHint: '↑ 松开取消',
|
||||
// PR-INPUT-PLACEHOLDER-DYNAMIC (2026-09-28): 输入框 placeholder 按上下文动态切换
|
||||
// 默认 / 有语音附件 / 有其他媒体附件, 三态文案互不冲突
|
||||
placeholderDefault: '发消息或按住说话',
|
||||
placeholderWithAudio: '给语音留言加个说明(可选)',
|
||||
placeholderWithMedia: '添加文字说明(可选)',
|
||||
voiceStartFailed: '无法开始录音',
|
||||
voiceStopFailed: '录音失败,请重试',
|
||||
voiceNotSupported: '当前平台不支持语音输入',
|
||||
|
||||
@@ -472,7 +472,7 @@
|
||||
ref="messageInput"
|
||||
v-model="inputText"
|
||||
class="message-input"
|
||||
placeholder="发消息或按住说话"
|
||||
:placeholder="inputPlaceholder"
|
||||
placeholder-class="message-input-placeholder"
|
||||
:maxlength="chatUiConfig.ui_input_max_length"
|
||||
:auto-height="true"
|
||||
@@ -885,6 +885,23 @@ export default {
|
||||
if (this.voiceHoldCancelling) return this.$lang('ai-chat.index.releaseToCancel')
|
||||
if (this.voiceHolding) return this.$lang('ai-chat.index.releaseToSend')
|
||||
return this.$lang('ai-chat.index.holdToTalk')
|
||||
},
|
||||
// PR-INPUT-PLACEHOLDER-DYNAMIC (2026-09-28): 输入框 placeholder 按上下文动态切换
|
||||
// - 有待发语音附件 → 提示"给语音加说明"
|
||||
// - 有待发图片/文件/视频附件 → 提示"添加文字说明"
|
||||
// - 默认态 → 提示"发消息或按住说话"
|
||||
// 优先级: 语音 > 其他媒体 > 默认
|
||||
inputPlaceholder() {
|
||||
const files = this.pendingFiles || []
|
||||
const hasAudio = files.some(f => f && f.type === 'audio')
|
||||
if (hasAudio) {
|
||||
return this.$lang('ai-chat.index.placeholderWithAudio') || '给语音留言加个说明(可选)'
|
||||
}
|
||||
const hasMedia = (this.pendingImages && this.pendingImages.length) || files.length > 0
|
||||
if (hasMedia) {
|
||||
return this.$lang('ai-chat.index.placeholderWithMedia') || '添加文字说明(可选)'
|
||||
}
|
||||
return this.$lang('ai-chat.index.placeholderDefault') || '发消息或按住说话'
|
||||
}
|
||||
},
|
||||
// 新增:组件销毁时清除所有定时器
|
||||
|
||||
Reference in New Issue
Block a user