History cleaning: stripping footer from previous messages to avoid LLM confusion
This commit is contained in:
@@ -73,7 +73,9 @@ DIRETRIZES:
|
||||
history_str = ""
|
||||
if chat_history:
|
||||
for m in chat_history[-5:]:
|
||||
history_str += f"\nUsuário: {m['user']}\nAgente: {m['bot']}\n"
|
||||
# Remove o rodapé (---) da mensagem do bot para não confundir a IA
|
||||
bot_msg = m['bot'].split("\n\n---")[0] if "\n\n---" in m['bot'] else m['bot']
|
||||
history_str += f"\nUsuário: {m['user']}\nAgente: {bot_msg}\n"
|
||||
history_str += f"\nUsuário: {prompt}\n"
|
||||
|
||||
current_history = history_str
|
||||
|
||||
Reference in New Issue
Block a user