Full sync - all projects, memory, configs
This commit is contained in:
49
debug_session.py
Normal file
49
debug_session.py
Normal file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
def debug_session_content(jsonl_file):
|
||||
"""Debug what types of content are in a session file"""
|
||||
print(f"Analyzing: {jsonl_file}")
|
||||
|
||||
user_messages = []
|
||||
assistant_messages = []
|
||||
|
||||
with open(jsonl_file, 'r') as f:
|
||||
for line_num, line in enumerate(f, 1):
|
||||
try:
|
||||
data = json.loads(line.strip())
|
||||
|
||||
if data.get('type') == 'message' and 'message' in data:
|
||||
role = data['message']['role']
|
||||
content = data['message']['content']
|
||||
|
||||
if role == 'user':
|
||||
if isinstance(content, list) and len(content) > 0:
|
||||
text_content = content[0].get('text', '')[:100] # First 100 chars
|
||||
user_messages.append(f"Line {line_num}: {text_content}")
|
||||
|
||||
elif role == 'assistant':
|
||||
if isinstance(content, list):
|
||||
text_parts = []
|
||||
for item in content:
|
||||
if item.get('type') == 'text':
|
||||
text_parts.append(item.get('text', ''))
|
||||
text_content = ' '.join(text_parts)[:100] # First 100 chars
|
||||
assistant_messages.append(f"Line {line_num}: {text_content}")
|
||||
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
|
||||
print(f"\nUser messages found: {len(user_messages)}")
|
||||
for msg in user_messages[:3]: # Show first 3
|
||||
print(f" {msg}")
|
||||
|
||||
print(f"\nAssistant messages found: {len(assistant_messages)}")
|
||||
for msg in assistant_messages[:3]: # Show first 3
|
||||
print(f" {msg}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
session_file = sys.argv[1] if len(sys.argv) > 1 else '/home/wdjones/.openclaw/agents/main/sessions/0ad2385b-3eaa-4d35-8481-591df2551a67.jsonl'
|
||||
debug_session_content(session_file)
|
||||
Reference in New Issue
Block a user