Skip to content

Commit 0199247

Browse files
committed
Filter out repeat sessions
1 parent 93989c7 commit 0199247

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/github/copilotRemoteAgent/chatSessionContentBuilder.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ export class ChatSessionContentBuilder {
3030
capi: CopilotApi,
3131
timelineEventsPromise: Promise<TimelineEvent[]>
3232
): Promise<Array<vscode.ChatRequestTurn | vscode.ChatResponseTurn2>> {
33-
const sortedSessions = sessions.slice().sort((a, b) =>
34-
new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
35-
);
33+
const sortedSessions = sessions
34+
.filter((session, index, array) =>
35+
array.findIndex(s => s.id === session.id) === index
36+
)
37+
.slice().sort((a, b) =>
38+
new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
39+
);
3640

3741
// Process all sessions concurrently while maintaining order
3842
const sessionResults = await Promise.all(

0 commit comments

Comments
 (0)