diff --git a/src/wechat/media.ts b/src/wechat/media.ts index fe053b4..807229b 100644 --- a/src/wechat/media.ts +++ b/src/wechat/media.ts @@ -73,9 +73,15 @@ export async function downloadImage(item: MessageItem): Promise { /** * Extract text content from a message item. - * Returns text_item.text or empty string. + * Handles text items and voice items (using ASR transcription). */ export function extractText(item: MessageItem): string { + if (item.type === MessageItemType.VOICE) { + const voiceText = item.voice_item?.voice_text || item.voice_item?.text; + if (voiceText) { + return `[语音] ${voiceText}`; + } + } return item.text_item?.text ?? ''; } diff --git a/src/wechat/types.ts b/src/wechat/types.ts index df135fe..46b255e 100644 --- a/src/wechat/types.ts +++ b/src/wechat/types.ts @@ -48,7 +48,9 @@ export interface ImageItem { export interface VoiceItem { cdn_media: CDNMedia; + media?: { encrypt_query_param: string; aes_key?: string }; voice_text?: string; + text?: string; } export interface FileItem {