Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/core/src/codewhispererChat/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export const defaultContextLengths: ContextLengths = {

export const defaultStreamingResponseTimeoutInMs = 180_000

export const maxHistoryMessages = 100

export const ignoredDirectoriesAndFiles = [
// Dependency directories
'node_modules',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import {
additionalContentInnerContextLimit,
workspaceChunkMaxSize,
defaultContextLengths,
maxHistoryMessages,
} from '../../constants'
import { ChatSession } from '../../clients/chat/v0/chat'
import { amazonQTabSuffix } from '../../../shared/constants'
Expand Down Expand Up @@ -1601,7 +1602,7 @@ export class ChatController {
// Do not include chatHistory for requests going to Mynah
request.conversationState.history = request.conversationState.currentMessage?.userInputMessage?.userIntent
? []
: this.chatHistoryDb.getMessages(tabID).map((chat) => messageToChatMessage(chat))
: this.chatHistoryDb.getMessages(tabID, maxHistoryMessages).map((chat) => messageToChatMessage(chat))
Copy link
Contributor

@tsmithsz tsmithsz Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might cause invalid history.

We added a limit of 250 based on the API spec here:
https://github.com/aws/aws-toolkit-vscode/blob/feature/agentic-chat/packages/core/src/shared/db/chatDb/chatDb.ts#L28

I think the limit was increased a month ago

request.conversationState.conversationId = session.sessionIdentifier

triggerPayload.documentReferences = this.mergeRelevantTextDocuments(triggerPayload.relevantTextDocuments)
Expand Down
Loading