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
+32
View File
@@ -140,3 +140,35 @@ test('buildVisionPayload does not mark billable usage when vision analysis fails
assert.equal(result?.billableImageCount, 0);
assert.doesNotMatch(result?.userMessage?.content?.[0]?.text ?? '', /Qwen VL 图片描述/);
});
test('buildVisionPayload strips image_url content parts for text-only Goose providers', async () => {
const result = await buildVisionPayload({
userId: 'user-1',
publishLayout: { publicUrl: 'https://m.tkmind.cn/MindSpace/user-1' },
userMessage: {
content: [
{ type: 'text', text: '这是什么' },
{
type: 'image_url',
image_url: { url: '/api/mindspace/v1/assets/asset-7/download?inline=1' },
},
],
metadata: {
imageUrls: ['/api/mindspace/v1/assets/asset-7/download?inline=1'],
},
},
localFetchAsset: async () => ({
buffer: Buffer.from('fake-image'),
mimeType: 'image/png',
}),
llmProviderService: {
analyzeImagesWithVision: async () => '蓝色方块',
},
});
assert.equal(
(result?.userMessage?.content ?? []).some((item) => item?.type === 'image_url'),
false,
);
assert.match(result?.userMessage?.content?.[0]?.text ?? '', /蓝色方块/);
});