fix: mistral ai bug 400 role user after role tool (#2695)

This commit is contained in:
Matéo
2025-09-08 10:38:55 +08:00
committed by GitHub
parent 099354c253
commit 39336ca00a

View File

@@ -203,6 +203,10 @@ function M:parse_messages(opts)
else
table.insert(final_messages, { role = self.role_map["assistant"], content = "Ok, I understand." })
end
else
if role == "user" and prev_role == "tool" and M.is_mistral(provider_conf.endpoint) then
table.insert(final_messages, { role = self.role_map["assistant"], content = "Ok, I understand." })
end
end
prev_role = role
table.insert(final_messages, message)