feat(bot): developing integration with solaris
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user