forked from open-webui/open-webui
refac: share chat routes
This commit is contained in:
parent
e4d101e550
commit
180dd3966b
2 changed files with 13 additions and 6 deletions
|
@ -181,6 +181,13 @@ class ChatTable:
|
|||
.order_by(Chat.timestamp.desc())
|
||||
]
|
||||
|
||||
def get_chat_by_id(self, id: str) -> Optional[ChatModel]:
|
||||
try:
|
||||
chat = Chat.get(Chat.id == id)
|
||||
return ChatModel(**model_to_dict(chat))
|
||||
except:
|
||||
return None
|
||||
|
||||
def get_chat_by_id_and_user_id(self, id: str, user_id: str) -> Optional[ChatModel]:
|
||||
try:
|
||||
chat = Chat.get(Chat.id == id, Chat.user_id == user_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue