Skip to content

Commit 66fa717

Browse files
fix: dedupe working files list (anomalyco#152)
1 parent 7e80fb7 commit 66fa717

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎src/app/utils/index.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,5 +510,17 @@ export function deriveArtifacts(list: MessageWithParts[]): ArtifactItem[] {
510510
}
511511

512512
export function deriveWorkingFiles(items: ArtifactItem[]): string[] {
513-
return items.map((item) => item.name).slice(0, 5);
513+
const results: string[] = [];
514+
const seen = new Set<string>();
515+
516+
for (const item of items) {
517+
const rawKey = item.path ?? item.name;
518+
const normalized = rawKey.trim().replace(/[\\/]+/g, "/").toLowerCase();
519+
if (!normalized || seen.has(normalized)) continue;
520+
seen.add(normalized);
521+
results.push(item.name);
522+
if (results.length >= 5) break;
523+
}
524+
525+
return results;
514526
}

0 commit comments

Comments
 (0)