mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-19 04:12:03 +03:00
da8e7513e6
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate): --------- Co-authored-by: Stan Girard <girard.stanislas@gmail.com>
88 lines
1.9 KiB
Python
88 lines
1.9 KiB
Python
from abc import ABC, abstractmethod
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
|
|
from modules.chat.dto.inputs import ChatMessageProperties, CreateChatHistory, QuestionAndAnswer
|
|
from modules.chat.entity.chat import Chat
|
|
|
|
|
|
class ChatsInterface(ABC):
|
|
@abstractmethod
|
|
def create_chat(self, new_chat):
|
|
"""
|
|
Insert a chat entry in "chats" db
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_chat_by_id(self, chat_id: str):
|
|
"""
|
|
Get chat details by chat_id
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def add_question_and_answer(
|
|
self, chat_id: UUID, question_and_answer: QuestionAndAnswer
|
|
) -> Optional[Chat]:
|
|
"""
|
|
Add a question and answer to the chat history
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_chat_history(self, chat_id: str):
|
|
"""
|
|
Get chat history by chat_id
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_user_chats(self, user_id: str):
|
|
"""
|
|
Get all chats for a user
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def update_chat_history(self, chat_history: CreateChatHistory):
|
|
"""
|
|
Update chat history
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def update_chat(self, chat_id, updates):
|
|
"""
|
|
Update chat details
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def update_message_by_id(self, message_id, updates):
|
|
"""
|
|
Update message details
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete_chat(self, chat_id):
|
|
"""
|
|
Delete chat
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete_chat_history(self, chat_id):
|
|
"""
|
|
Delete chat history
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def update_chat_message(self, chat_id, message_id, chat_message_properties: ChatMessageProperties):
|
|
"""
|
|
Update chat message
|
|
"""
|
|
pass
|