feat(bot): developing integration with solaris

This commit is contained in:
h
2025-07-07 01:26:03 +03:00
parent 1b52c7fdca
commit fbccb91630
16 changed files with 145 additions and 21 deletions

View File

@@ -11,11 +11,24 @@ class SessionBase(BaseModel):
history: List[Content] = Field(default_factory=list)
class ReviewSession(SessionBase, Document):
class __CommonSessionRepository(SessionBase, Document):
@classmethod
async def get_by_chat_id(cls, chat_id: int):
return await cls.find_one(cls.chat_id == chat_id)
@classmethod
async def create_empty(cls, chat_id: int, system_prompt: str):
return await cls(chat_id=chat_id, system_prompt=system_prompt).insert()
async def update_history(self, history: List[Content]):
await self.set({self.history: history})
class ReviewSession(__CommonSessionRepository):
class Settings:
name = "review_sessions"
class RespondSession(SessionBase, Document):
class RespondSession(__CommonSessionRepository):
class Settings:
name = "respond_sessions"