Merge pull request #55 from Diegox-17/patch-1
Fix LLM error by cleaning up CONSCIOUSLY message history
This commit is contained in:
@@ -189,6 +189,17 @@ func (cb *ContextBuilder) BuildMessages(history []providers.Message, summary str
|
|||||||
systemPrompt += "\n\n## Summary of Previous Conversation\n\n" + summary
|
systemPrompt += "\n\n## Summary of Previous Conversation\n\n" + summary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//This fix prevents the session memory from LLM failure due to elimination of toolu_IDs required from LLM
|
||||||
|
// --- INICIO DEL FIX ---
|
||||||
|
//Diegox-17
|
||||||
|
for len(history) > 0 && (history[0].Role == "tool") {
|
||||||
|
logger.DebugCF("agent", "Removing orphaned tool message from history to prevent LLM error",
|
||||||
|
map[string]interface{}{"role": history[0].Role})
|
||||||
|
history = history[1:]
|
||||||
|
}
|
||||||
|
//Diegox-17
|
||||||
|
// --- FIN DEL FIX ---
|
||||||
|
|
||||||
messages = append(messages, providers.Message{
|
messages = append(messages, providers.Message{
|
||||||
Role: "system",
|
Role: "system",
|
||||||
Content: systemPrompt,
|
Content: systemPrompt,
|
||||||
|
|||||||
Reference in New Issue
Block a user