fix(wechat): scrub image_url from sessions and harden vision handoff.
Memind CI / Test, build, and release guards (pull_request) Failing after 19s
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:
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
buildCurrentTurnImageScopeNote,
|
||||
conversationHasImageUrlContent,
|
||||
dedupeImageUrlsByAssetKey,
|
||||
extractCurrentTurnImageUrls,
|
||||
scrubConversationHistoricalImageAttachments,
|
||||
@@ -113,3 +114,46 @@ test('buildCurrentTurnImageScopeNote states one independent topic per upload', (
|
||||
assert.match(note, /不得与历史轮次混用/);
|
||||
assert.match(note, /asset=asset-9/);
|
||||
});
|
||||
|
||||
test('conversationHasImageUrlContent detects historical poison and ignores active turn', () => {
|
||||
const conversation = [
|
||||
{
|
||||
id: 'assistant-old',
|
||||
role: 'assistant',
|
||||
content: [
|
||||
{ type: 'text', text: '看图' },
|
||||
{ type: 'image_url', image_url: { url: 'https://example.com/old.png' } },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'user-new',
|
||||
role: 'user',
|
||||
content: [
|
||||
{ type: 'text', text: '这是什么' },
|
||||
{ type: 'image_url', image_url: { url: 'https://example.com/new.png' } },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
assert.equal(conversationHasImageUrlContent(conversation), true);
|
||||
assert.equal(
|
||||
conversationHasImageUrlContent(conversation, { excludeMessageId: 'user-new' }),
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
conversationHasImageUrlContent(
|
||||
[
|
||||
{
|
||||
id: 'user-new',
|
||||
role: 'user',
|
||||
content: [
|
||||
{ type: 'text', text: '这是什么' },
|
||||
{ type: 'image_url', image_url: { url: 'https://example.com/new.png' } },
|
||||
],
|
||||
},
|
||||
],
|
||||
{ excludeMessageId: 'user-new' },
|
||||
),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user