summaryrefslogtreecommitdiff
path: root/backend/storage.py
diff options
context:
space:
mode:
authorkarpathy <andrej.karpathy@gmail.com>2025-11-22 15:08:53 -0800
committerkarpathy <andrej.karpathy@gmail.com>2025-11-22 15:08:53 -0800
commit827bfd3d3ecc34ac5f6a21003c785460d1b02d2b (patch)
treec291d2ebe0696621a8aad8927a2c570e8de2f5dc /backend/storage.py
parenteb0eb26f4cefa4880c895ff017f312e8674f9b73 (diff)
Label maker add
Diffstat (limited to 'backend/storage.py')
-rw-r--r--backend/storage.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/backend/storage.py b/backend/storage.py
index dd17a1a..180111d 100644
--- a/backend/storage.py
+++ b/backend/storage.py
@@ -33,6 +33,7 @@ def create_conversation(conversation_id: str) -> Dict[str, Any]:
conversation = {
"id": conversation_id,
"created_at": datetime.utcnow().isoformat(),
+ "title": "New Conversation",
"messages": []
}
@@ -96,6 +97,7 @@ def list_conversations() -> List[Dict[str, Any]]:
conversations.append({
"id": data["id"],
"created_at": data["created_at"],
+ "title": data.get("title", "New Conversation"),
"message_count": len(data["messages"])
})
@@ -152,3 +154,19 @@ def add_assistant_message(
})
save_conversation(conversation)
+
+
+def update_conversation_title(conversation_id: str, title: str):
+ """
+ Update the title of a conversation.
+
+ Args:
+ conversation_id: Conversation identifier
+ title: New title for the conversation
+ """
+ conversation = get_conversation(conversation_id)
+ if conversation is None:
+ raise ValueError(f"Conversation {conversation_id} not found")
+
+ conversation["title"] = title
+ save_conversation(conversation)