2025-12-14 17:28:04 +03:00

29 lines
832 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
Доменная сущность Conversation
"""
from datetime import datetime
from uuid import UUID, uuid4
class Conversation:
"""Беседа пользователя с ИИ"""
def __init__(
self,
user_id: UUID,
collection_id: UUID,
conversation_id: UUID | None = None,
created_at: datetime | None = None,
updated_at: datetime | None = None
):
self.conversation_id = conversation_id or uuid4()
self.user_id = user_id
self.collection_id = collection_id
self.created_at = created_at or datetime.utcnow()
self.updated_at = updated_at or datetime.utcnow()
def update_timestamp(self):
"""Обновить время последнего изменения"""
self.updated_at = datetime.utcnow()