quivr/backend/models/chat.py
Matt 6f047f4a39
feat: streaming for standard brain picking (#385)
* feat: streaming for standard brain picking

* fix(bug): private llm

* wip: test

Co-authored-by: Mamadou DICKO <mamadoudicko@users.noreply.github.com>

* wip: almost good

Co-authored-by: Mamadou DICKO <mamadoudicko@users.noreply.github.com>

* feat: useFetch

* chore: remove 💀

* chore: fix linting

* fix: forward the request if not streaming

* feat: streaming for standard brain picking

* fix(bug): private llm

* wip: test

Co-authored-by: Mamadou DICKO <mamadoudicko@users.noreply.github.com>

* wip: almost good

Co-authored-by: Mamadou DICKO <mamadoudicko@users.noreply.github.com>

* feat: useFetch

* chore: remove 💀

* chore: fix linting

* fix: forward the request if not streaming

* fix: 💀 code

* fix: check_user_limit

* feat: brain_id to new chat stream

* fix: missing imports

* feat: message_id created on backend

Co-authored-by: Mamadou DICKO <mamadoudicko@users.noreply.github.com>

* chore: remove dead

* remove: cpython

* remove: dead

---------

Co-authored-by: Mamadou DICKO <mamadoudicko@users.noreply.github.com>
2023-06-30 10:10:59 +02:00

35 lines
889 B
Python

from dataclasses import asdict, dataclass
@dataclass
class Chat:
chat_id: str
user_id: str
creation_time: str
chat_name: str
def __init__(self, chat_dict: dict):
self.chat_id = chat_dict.get("chat_id")
self.user_id = chat_dict.get("user_id")
self.creation_time = chat_dict.get("creation_time")
self.chat_name = chat_dict.get("chat_name")
@dataclass
class ChatHistory:
chat_id: str
message_id: str
user_message: str
assistant: str
message_time: str
def __init__(self, chat_dict: dict):
self.chat_id = chat_dict.get("chat_id")
self.message_id = chat_dict.get("message_id")
self.user_message = chat_dict.get("user_message")
self.assistant = chat_dict.get("assistant")
self.message_time = chat_dict.get("message_time")
def to_dict(self):
return asdict(self)