Pass clean conversation history to API for Anthropic

This commit is contained in:
Matt Rubens
2024-12-31 03:14:02 -08:00
parent 468799e1a9
commit 26f7ba07c2
2 changed files with 8 additions and 1 deletions

View File

@@ -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 {