refac
This commit is contained in:
1 parent
6b66cb5ef6
commit
adcc50d337
2 files changed
+8
-1
No files matched your search
@@ -2146,9 +2146,15 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||||||
# Check if the request has chat_id and is inside of a folder
|
# Check if the request has chat_id and is inside of a folder
|
||||||
# Uses lightweight column query — only fetches folder_id, not the full chat JSON blob
|
# Uses lightweight column query — only fetches folder_id, not the full chat JSON blob
|
||||||
chat_id = metadata.get('chat_id', None)
|
chat_id = metadata.get('chat_id', None)
|
||||||
|
folder_id = None
|
||||||
if chat_id and user:
|
if chat_id and user:
|
||||||
folder_id = Chats.get_chat_folder_id(chat_id, user.id)
|
folder_id = Chats.get_chat_folder_id(chat_id, user.id)
|
||||||
if folder_id:
|
|
||||||
|
# Fallback: use folder_id from metadata (temporary chats have no DB record)
|
||||||
|
if not folder_id:
|
||||||
|
folder_id = metadata.get('folder_id', None)
|
||||||
|
|
||||||
|
if folder_id and user:
|
||||||
folder = Folders.get_folder_by_id_and_user_id(folder_id, user.id)
|
folder = Folders.get_folder_by_id_and_user_id(folder_id, user.id)
|
||||||
|
|
||||||
if folder and folder.data:
|
if folder and folder.data:
|
||||||
|
|||||||
@@ -2221,6 +2221,7 @@
|
|||||||
|
|
||||||
session_id: $socket?.id,
|
session_id: $socket?.id,
|
||||||
chat_id: $chatId,
|
chat_id: $chatId,
|
||||||
|
folder_id: $selectedFolder?.id ?? undefined,
|
||||||
|
|
||||||
id: responseMessageId,
|
id: responseMessageId,
|
||||||
parent_id: userMessage?.id ?? null,
|
parent_id: userMessage?.id ?? null,
|
||||||
|
|||||||
Reference in new issue
Block a user