Skip to content

Commit db976c9

Browse files
authored
fix(amazonq): duplicate code reference in reference log (aws#7208)
## Problem We're currently adding the reference log on partial responses and on complete responses, causing duplicate messages ## Solution on flare side we're combining all code references into the final response, so we just need to emit once --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 0157f7e commit db976c9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,6 @@ async function handlePartialResult<T extends ChatResult>(
532532
tabId: tabId,
533533
})
534534
}
535-
536-
for (const ref of decryptedMessage.codeReference ?? []) {
537-
ReferenceLogViewProvider.instance.addReferenceLog(referenceLogText(ref))
538-
}
539535
}
540536

541537
/**
@@ -556,6 +552,8 @@ async function handleCompleteResult<T extends ChatResult>(
556552
params: decryptedMessage,
557553
tabId: tabId,
558554
})
555+
556+
// only add the reference log once the request is complete, otherwise we will get duplicate log items
559557
for (const ref of decryptedMessage.codeReference ?? []) {
560558
ReferenceLogViewProvider.instance.addReferenceLog(referenceLogText(ref))
561559
}

0 commit comments

Comments
 (0)