From 26f7ba07c2ab8d9714de5d00a81c9be75782e760 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Tue, 31 Dec 2024 03:14:02 -0800 Subject: [PATCH] Pass clean conversation history to API for Anthropic --- .changeset/stupid-pears-help.md | 5 +++++ src/core/Cline.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/stupid-pears-help.md diff --git a/.changeset/stupid-pears-help.md b/.changeset/stupid-pears-help.md new file mode 100644 index 0000000..08f7a5d --- /dev/null +++ b/.changeset/stupid-pears-help.md @@ -0,0 +1,5 @@ +--- +"roo-cline": patch +--- + +Hotfix diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 218c0e8..0970e04 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -807,7 +807,9 @@ export class Cline { } } - const stream = this.api.createMessage(systemPrompt, this.apiConversationHistory) + // Convert to Anthropic.MessageParam by spreading only the API-required properties + const cleanConversationHistory = this.apiConversationHistory.map(({ role, content }) => ({ role, content })) + const stream = this.api.createMessage(systemPrompt, cleanConversationHistory) const iterator = stream[Symbol.asyncIterator]() try {