Spaces:
Running
Running
File size: 439 Bytes
f8c79ce 0a9155d f8c79ce 0a9155d f8c79ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
memory = []
def update_memory(user_input, response):
memory.append({"input": user_input, "response": response})
if len(memory) > 5:
memory.pop(0)
def summarize_context():
if not memory:
return ""
summary = "\n\n🧩 Контекст последних запросов:\n"
for i, m in enumerate(memory[-3:], 1):
summary += f"{i}. {m['input']} → {m['response'][:80]}...\n"
return summary
|