fix(wechat): scrub image_url from sessions and harden vision handoff.
Memind CI / Test, build, and release guards (pull_request) Failing after 19s

Strip image_url from persisted session payloads, keep image turns scoped to the active request, and align proxy/vision/page-data paths so WeChat image history does not leak into fresh sessions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-29 14:04:15 +08:00
parent 2f51041822
commit 53c5f6d9c2
9 changed files with 222 additions and 7 deletions
+19
View File
@@ -130,6 +130,25 @@ export function scrubUserMessageImageAttachments(message) {
};
}
export function messageContentHasImageUrl(content) {
if (!Array.isArray(content)) return false;
return content.some((item) => item?.type === 'image_url' && item?.image_url?.url);
}
/**
* Any persisted image_url part will break DeepSeek / other text-only providers.
* User metadata.imageUrls alone is not enough — Goose may have expanded them into
* content parts on assistant or user turns.
*/
export function conversationHasImageUrlContent(conversation, { excludeMessageId = null } = {}) {
if (!Array.isArray(conversation)) return false;
const excluded = String(excludeMessageId ?? '').trim();
return conversation.some((message) => {
if (excluded && String(message?.id ?? '').trim() === excluded) return false;
return messageContentHasImageUrl(message?.content);
});
}
export function scrubConversationHistoricalImageAttachments(conversation, activeMessageId) {
const activeId = String(activeMessageId ?? '').trim();
if (!Array.isArray(conversation) || !activeId) {