init
This commit is contained in:
19
new-planet-backend/app/models/ai_conversation.py
Normal file
19
new-planet-backend/app/models/ai_conversation.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from sqlalchemy import Column, String, ForeignKey, Text, Integer, JSON
|
||||
from sqlalchemy.orm import relationship
|
||||
from app.db.base import BaseModel
|
||||
|
||||
|
||||
class AIConversation(BaseModel):
|
||||
__tablename__ = "ai_conversations"
|
||||
|
||||
user_id = Column(String, ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
conversation_id = Column(String, nullable=False, unique=True, index=True)
|
||||
message = Column(Text, nullable=False)
|
||||
response = Column(Text, nullable=False)
|
||||
tokens_used = Column(Integer, nullable=True)
|
||||
model = Column(String(100), nullable=True)
|
||||
context = Column(JSON, nullable=True) # Сохранение контекста для продолжения диалога
|
||||
|
||||
# Relationships
|
||||
user = relationship("User", back_populates="conversations")
|
||||
|
||||
Reference in New Issue
Block a user