summaryrefslogtreecommitdiff
path: root/backend/storage.py
diff options
context:
space:
mode:
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)