mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix: prevent API error messages from polluting chat history
Remove error message from API conversation history when assistant provides no response.
Keep error display to user via say("error") but do not add to LLM context.
This fixes the issue where API errors disrupt conversation flow.
Fixes #7249
This commit is contained in:
parent
c608392a85
commit
025e6053a6
1 changed files with 3 additions and 4 deletions
|
|
@ -2132,10 +2132,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
|
|||
"Unexpected API Response: The language model did not provide any assistant messages. This may indicate an issue with the API or the model's output.",
|
||||
)
|
||||
|
||||
await this.addToApiConversationHistory({
|
||||
role: "assistant",
|
||||
content: [{ type: "text", text: "Failure: I did not provide a response." }],
|
||||
})
|
||||
// Don't add error messages to the API conversation history as it pollutes
|
||||
// the context sent to the LLM. The error is already shown to the user via say("error").
|
||||
// This prevents the issue where API errors disrupt the conversation flow.
|
||||
}
|
||||
|
||||
// If we reach here without continuing, return false (will always be false for now)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue