MCPcopy
hub / github.com/karpathy/llm-council / list_conversations

Function list_conversations

backend/storage.py:81–107  ·  view source on GitHub ↗

List all conversations (metadata only). Returns: List of conversation metadata dicts

()

Source from the content-addressed store, hash-verified

79
80
81def list_conversations() -> List[Dict[str, Any]]:
82 """
83 List all conversations (metadata only).
84
85 Returns:
86 List of conversation metadata dicts
87 """
88 ensure_data_dir()
89
90 conversations = []
91 for filename in os.listdir(DATA_DIR):
92 if filename.endswith('.json'):
93 path = os.path.join(DATA_DIR, filename)
94 with open(path, 'r') as f:
95 data = json.load(f)
96 # Return metadata only
97 conversations.append({
98 "id": data["id"],
99 "created_at": data["created_at"],
100 "title": data.get("title", "New Conversation"),
101 "message_count": len(data["messages"])
102 })
103
104 # Sort by creation time, newest first
105 conversations.sort(key=lambda x: x["created_at"], reverse=True)
106
107 return conversations
108
109
110def add_user_message(conversation_id: str, content: str):

Callers

nothing calls this directly

Calls 1

ensure_data_dirFunction · 0.85

Tested by

no test coverage detected