List all conversations (metadata only). Returns: List of conversation metadata dicts
()
| 79 | |
| 80 | |
| 81 | def 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 | |
| 110 | def add_user_message(conversation_id: str, content: str): |
nothing calls this directly
no test coverage detected