persistant history
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# test_history_persistence.py
|
||||
from agent.history import ConversationHistory
|
||||
|
||||
# Create history
|
||||
history = ConversationHistory(session_id="test-session")
|
||||
history.add_message("user", "Hello")
|
||||
history.add_message("assistant", "Hi there!")
|
||||
|
||||
print(f"Session ID: {history.session_id}")
|
||||
print(f"Messages: {len(history.messages)}")
|
||||
|
||||
# Verify file exists
|
||||
print(f"File exists: {history.file.exists()}")
|
||||
print(f"File contents:")
|
||||
print(history.file.read_text())
|
||||
|
||||
# Create new instance with same session_id
|
||||
history2 = ConversationHistory(session_id="test-session")
|
||||
print(f"\nLoaded messages: {len(history2.messages)}")
|
||||
print(f"First message: {history2.messages[0]}")
|
||||
|
||||
# Clean up
|
||||
history.clear()
|
||||
Reference in New Issue
Block a user