mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 12:29:41 +02:00
Bugfix for Selected Doc when the message it is selected from failed (#1711)
This commit is contained in:
@@ -371,10 +371,19 @@ def get_doc_query_identifiers_from_model(
|
|||||||
)
|
)
|
||||||
raise ValueError("Docs references do not belong to user")
|
raise ValueError("Docs references do not belong to user")
|
||||||
|
|
||||||
if any(
|
try:
|
||||||
[doc.chat_messages[0].chat_session_id != chat_session.id for doc in search_docs]
|
if any(
|
||||||
):
|
[
|
||||||
raise ValueError("Invalid reference doc, not from this chat session.")
|
doc.chat_messages[0].chat_session_id != chat_session.id
|
||||||
|
for doc in search_docs
|
||||||
|
]
|
||||||
|
):
|
||||||
|
raise ValueError("Invalid reference doc, not from this chat session.")
|
||||||
|
except IndexError:
|
||||||
|
# This happens when the doc has no chat_messages associated with it.
|
||||||
|
# which happens as an edge case where the chat message failed to save
|
||||||
|
# This usually happens when the LLM fails either immediately or partially through.
|
||||||
|
raise RuntimeError("Chat session failed, please start a new session.")
|
||||||
|
|
||||||
doc_query_identifiers = [(doc.document_id, doc.chunk_ind) for doc in search_docs]
|
doc_query_identifiers = [(doc.document_id, doc.chunk_ind) for doc in search_docs]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user