Skip to content

Commit 5bce803

Browse files
committed
fix for assistant response warning message.
1 parent 6baf872 commit 5bce803

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/core/src/codewhispererChat/storages/chatHistory.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ export class ChatHistoryManager {
8080
* Push an assistant message to the history
8181
*/
8282
public pushAssistantMessage(newMessage: ChatMessage): void {
83-
if (newMessage !== undefined && this.lastUserMessage !== undefined) {
84-
this.logger.warn('last Message should not be defined when pushing an assistant message')
83+
if (newMessage !== undefined && this.lastUserMessage === undefined) {
84+
this.logger.warn('Assistant response should always come after user input message')
85+
return
8586
}
8687
// check if last message in histroy is assistant message and now replace it in that case
8788
if (this.history.length > 0 && this.history.at(-1)?.assistantResponseMessage) {

0 commit comments

Comments
 (0)