|
|
@@ -90,7 +90,7 @@ const uploadFile = async (file: File) => {
|
|
|
filename: data.filename,
|
|
|
media_type: data.media_type,
|
|
|
size: data.size,
|
|
|
- preview_url: previewUrl,
|
|
|
+ preview_url: data.preview_url || previewUrl, // 优先使用后端预览 URL
|
|
|
uploading: false,
|
|
|
};
|
|
|
} catch (error: any) {
|
|
|
@@ -119,7 +119,7 @@ const hasUploadingFiles = () => attachments.value.some(a => a.uploading);
|
|
|
|
|
|
const sendMessage = () => {
|
|
|
if ((!message.value.trim() && attachments.value.length === 0) || props.isLoading || hasUploadingFiles()) return;
|
|
|
- const files = attachments.value.map(({ file_id, filename, media_type, size }) => ({ file_id, filename, media_type, size }));
|
|
|
+ const files = attachments.value.map(({ file_id, filename, media_type, size, preview_url }) => ({ file_id, filename, media_type, size, preview_url }));
|
|
|
emit('send', message.value, stream.value, files.length > 0 ? files : undefined);
|
|
|
message.value = '';
|
|
|
attachments.value = [];
|
|
|
@@ -174,10 +174,10 @@ onMounted(() => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-const toggleVoiceMode = () => {
|
|
|
+/*const toggleVoiceMode = () => {
|
|
|
if (isRecording.value || isTranscribing.value) return;
|
|
|
isVoiceMode.value = !isVoiceMode.value;
|
|
|
-};
|
|
|
+};*/
|
|
|
|
|
|
const recordingAreaClasses = computed(() => {
|
|
|
if (isTranscribing.value) return 'bg-blue-900/50 border-blue-500';
|
|
|
@@ -364,7 +364,7 @@ const sendVoice = async (audioBlob: Blob) => {
|
|
|
|
|
|
if (data.text && data.text.trim()) {
|
|
|
// 语音转写文字 + 已上传的附件(图片/视频)一起发送
|
|
|
- const files = attachments.value.map(({ file_id, filename, media_type, size }) => ({ file_id, filename, media_type, size }));
|
|
|
+ const files = attachments.value.map(({ file_id, filename, media_type, size, preview_url }) => ({ file_id, filename, media_type, size, preview_url }));
|
|
|
emit('send', data.text, stream.value, files.length > 0 ? files : undefined);
|
|
|
attachments.value = [];
|
|
|
} else {
|
|
|
@@ -513,7 +513,8 @@ const sendVoice = async (audioBlob: Blob) => {
|
|
|
</span>
|
|
|
</div>
|
|
|
|
|
|
- <!-- 麦克风按钮 -->
|
|
|
+ <!-- [临时隐藏] 麦克风按钮 - 待 Android WebView 权限适配完成后恢复 -->
|
|
|
+ <!--
|
|
|
<button
|
|
|
v-if="voiceSupported"
|
|
|
@click="toggleVoiceMode"
|
|
|
@@ -531,8 +532,9 @@ const sendVoice = async (audioBlob: Blob) => {
|
|
|
d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4M12 15a3 3 0 003-3V5a3 3 0 00-6 0v7a3 3 0 003 3z" />
|
|
|
</svg>
|
|
|
</button>
|
|
|
+ -->
|
|
|
|
|
|
- <!-- 发送按钮(仅文字模式显示) -->
|
|
|
+ <!-- 发送按钮 -->
|
|
|
<button
|
|
|
v-if="!isVoiceMode"
|
|
|
@click="sendMessage"
|