From 8fde1d8597ab6846bd6dca42a7419218d96ff247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Wed, 5 Aug 2026 10:23:01 +0800 Subject: [PATCH] fix: render chat media by URL (images/video/voice) instead of unknown-type placeholder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MessageBubble.vue was keys off the (incomplete) type code, so many messages with real OSS media URLs (https://wx.oss.yunkecn.com/.../*.webp|*.mp4) showed as '[未知消息]'. Rendering is now URL-driven: pick the best http URL from file_url > file_hd_url > file_th_url, then render by extension (image/video/audio/file). Type code is only used as a last-resort label. - MessageBubble.vue: URL-driven cascade (URL by ext → duration → transcription → text → structured-type placeholder → localized tag). Image/video/audio/file children @click.stop so the all-fields drawer still opens on bubble click but not on media interactions. - format.ts: wechatTypeLabel(type_raw) maps known codes (3→图片, 34→语音, 43→图片/表情, 49→文件/名片, 42→名片, 9→表情, 20→红包/转账). - ChatTimeline.vue drawer type tag uses wechatTypeLabel for WeChat msgs. - style.css: compact .yk-msg__audio player for voice-with-URL messages. Verified against smoke.db: 25 type-3 images + 3 type-43 videos that previously showed '[未知消息]' now render as images/video. Build clean. Co-Authored-By: Claude --- yunkes/src/components/MessageBubble.vue | 204 +++++++++++++++++------- yunkes/src/style.css | 8 + yunkes/src/utils/format.ts | 32 ++++ yunkes/src/views/ChatTimeline.vue | 6 +- 4 files changed, 192 insertions(+), 58 deletions(-) diff --git a/yunkes/src/components/MessageBubble.vue b/yunkes/src/components/MessageBubble.vue index c63d552..2000ccd 100644 --- a/yunkes/src/components/MessageBubble.vue +++ b/yunkes/src/components/MessageBubble.vue @@ -1,22 +1,32 @@