fix: render inline support images
Deploy olons-server production / deploy (push) Successful in 4m1s

This commit is contained in:
Your Name
2026-10-19 18:06:00 +08:00
parent db18514e6d
commit db1367b8fe
2 changed files with 43 additions and 1 deletions
+5 -1
View File
@@ -349,10 +349,14 @@ function messageContent(content: unknown, mediaURL: (ref?: string) => string) {
const media = drafty.ent?.find((entity) => entity?.tp === 'IM' || entity?.tp === 'VD');
if (media?.data) {
const type = media.tp === 'VD' ? 'video' : 'image';
const inline = typeof media.data.val === 'string' ? media.data.val : '';
const mime = typeof media.data.mime === 'string' && media.data.mime.startsWith(`${type}/`)
? media.data.mime
: type === 'video' ? 'video/webm' : 'image/jpeg';
return {
text: '',
type,
media_url: mediaURL(String(media.data.ref || '')),
media_url: inline ? `data:${mime};base64,${inline}` : mediaURL(String(media.data.ref || '')),
preview_url: mediaURL(String(media.data.preref || '')),
file_name: String(media.data.name || ''),
} as const;