new is_agentic flag for chatmessages (#4026)

* new is_agentic flag for chatmessages

* added cancelled error to db

* added cancelled error to returned message
This commit is contained in:
evan-danswer
2025-02-17 20:20:33 -08:00
committed by GitHub
parent 045a41d929
commit 2b2ba5478c
5 changed files with 54 additions and 2 deletions

View File

@@ -146,6 +146,7 @@ from onyx.utils.timing import log_generator_function_time
from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR
logger = setup_logger()
ERROR_TYPE_CANCELLED = "cancelled"
def _translate_citations(
@@ -631,6 +632,7 @@ def stream_chat_message_objects(
db_session=db_session,
commit=False,
reserved_message_id=reserved_message_id,
is_agentic=new_msg_req.use_agentic_search,
)
prompt_override = new_msg_req.prompt_override or chat_session.prompt_override
@@ -1015,7 +1017,7 @@ def stream_chat_message_objects(
if info.message_specific_citations
else None
),
error=None,
error=ERROR_TYPE_CANCELLED if answer.is_cancelled() else None,
tool_call=(
ToolCall(
tool_id=tool_name_to_tool_id[info.tool_result.tool_name],
@@ -1053,7 +1055,9 @@ def stream_chat_message_objects(
citations=info.message_specific_citations.citation_map
if info.message_specific_citations
else None,
error=ERROR_TYPE_CANCELLED if answer.is_cancelled() else None,
refined_answer_improvement=refined_answer_improvement,
is_agentic=True,
)
next_level += 1
prev_message = next_answer_message