Closed abeatrix closed 6 days ago
Anything we can do here?
I was thinking we could truncate the input, but we might truncate the important part of the input without users knowing. I will create a linear issue and get the product for input on what's the best way to handle this case?
Edit: Updated the error message and set it as a transcript message to provide steps for users to unblock themselves:
CLOSE https://linear.app/sourcegraph/issue/CODY-1608/chat-token-usage-must-be-updated-before-context CLOSE https://github.com/sourcegraph/cody/issues/4195
tryAddMessages
inPromptBuilder
to returnundefined
when all messages are added successfullyDefaultPrompter
, throw an error if no transcript was added due to the context window limit being reachedThis ensures the user is aware when the chat input has exceeded the allowed token limit, and the error stops the prompt building process from processing so that it would move to the step where we add context without transcript.
Test plan