fix: allows truncation for empty conversation, for when automatic truncation is tried after failed request (#6200)
This commit is contained in:
1 parent
0b551de152
commit
a8ba96ff4a
1 file changed
+1
-1
@@ -291,7 +291,7 @@ export class ContextManager {
|
||||
|
||||
// Make sure that the last message being removed is a assistant message, so the next message after the initial user-assistant pair is an assistant message. This preserves the user-assistant-user-assistant structure.
|
||||
// NOTE: anthropic format messages are always user-assistant-user-assistant, while openai format messages can have multiple user messages in a row (we use anthropic format throughout cline)
|
||||
if (apiMessages[rangeEndIndex].role !== "assistant") {
|
||||
if (apiMessages[rangeEndIndex] && apiMessages[rangeEndIndex].role !== "assistant") {
|
||||
rangeEndIndex -= 1
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user