Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 保留排队图片托管地址
DavidShen051d3925a241
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/normalizeAttachmentsTemp.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/normalizeAttachmentsTemp.test.tsindex ac0cd515a4..2a8cec6527 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/normalizeAttachmentsTemp.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/normalizeAttachmentsTemp.test.ts@@ -220,20 +220,38 @@ describe('inline attachment temporary files', () => {expect(downloadToFile).not.toHaveBeenCalled();});- it('keeps queued annotated images on their burned image URL', async () => {+ it('keeps queued images on managed URLs instead of rematerializing their source paths', async () => {const burnedUrl = 'xdt-image://queued-annotated/annotated.png';+ const selectedUrl = 'xdt-image://queued-selected/selected.png';+ const mediaUrl = `cindy-media://blobs/${'d'.repeat(64)}.png`;const originalPath = path.join(tempRoot.value, 'original.png');await fs.writeFile(originalPath, Buffer.from([0x89, 0x50, 0x4e, 0x47]));const item = {clientId: 'queued-annotated-image',- files: [{- category: 'image',- ext: '.png',- path: originalPath,- url: burnedUrl,- mimeType: 'image/png',- annotated: true,- }],+ files: [+ {+ category: 'image',+ ext: '.png',+ path: originalPath,+ url: selectedUrl,+ mimeType: 'image/png',+ },+ {+ category: 'image',+ ext: '.png',+ path: originalPath,+ url: mediaUrl,+ mimeType: 'image/png',+ },+ {+ category: 'image',+ ext: '.png',+ path: originalPath,+ url: burnedUrl,+ mimeType: 'image/png',+ annotated: true,+ },+ ],};const materialized = await materializeQueuedOssAttachmentsDeferred(diff --git a/apps/desktop/src/main/maker-ipc/normalizeAttachments.ts b/apps/desktop/src/main/maker-ipc/normalizeAttachments.tsindex a3e35891b1..fe7c398b4e 100644--- a/apps/desktop/src/main/maker-ipc/normalizeAttachments.ts+++ b/apps/desktop/src/main/maker-ipc/normalizeAttachments.ts@@ -418,7 +418,6 @@ type SerializedFileLike = {type?: unknown;category?: unknown;ext?: unknown;- annotated?: unknown;};function isQueuedImageFile(file: SerializedFileLike): boolean {@@ -459,12 +458,17 @@ function needsImageMaterialize(v: unknown): v is string {return isOssRefField(v) || isLocalImagePathField(v);}+function isManagedImageUrl(v: unknown): v is string {+ return (+ typeof v === 'string'+ && (v.startsWith('xdt-image://') || v.startsWith('cindy-media://'))+ );+}+function queuedFileMaterializeRef(file: SerializedFileLike): string | null {if (isOssRefField(file.url)) return file.url;- // 标注图的 url 是烧录位图,path 仍是原始磁盘图;本地队列必须继续使用 url。- if (file.annotated === true && typeof file.url === 'string' && file.url.length > 0) {- return null;- }+ // url 是队列实际消费的图片;path 只是文件选择器保留的原始磁盘来源。+ if (isQueuedImageFile(file) && isManagedImageUrl(file.url)) return null;if (isOssRefField(file.path)) return file.path;if (!isQueuedImageFile(file)) return null;if (isLocalImagePathField(file.url)) return file.url;