mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-07 19:38:19 +02:00
Bugfix for Selected Doc when the message it is selected from failed (#1711)
This commit is contained in:
parent
7d2b0ffcc5
commit
0d814939ee
@ -371,10 +371,19 @@ def get_doc_query_identifiers_from_model(
|
||||
)
|
||||
raise ValueError("Docs references do not belong to user")
|
||||
|
||||
if any(
|
||||
[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.")
|
||||
try:
|
||||
if any(
|
||||
[
|
||||
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]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user