fixed /danswer handling (#2436)

* fixed

* mypy

* cleaned up and commented

* mypy

* Update handle_regular_answer.py
This commit is contained in:
hagen-danswer
2024-09-13 18:21:13 -07:00
committed by GitHub
parent d807ad7699
commit a63cb9da43

View File

@@ -135,7 +135,8 @@ def handle_regular_answer(
else slack_bot_config.response_type == SlackBotResponseType.CITATIONS else slack_bot_config.response_type == SlackBotResponseType.CITATIONS
) )
if not message_ts_to_respond_to: if not message_ts_to_respond_to and not is_bot_msg:
# if the message is not "/danswer" command, then it should have a message ts to respond to
raise RuntimeError( raise RuntimeError(
"No message timestamp to respond to in `handle_message`. This should never happen." "No message timestamp to respond to in `handle_message`. This should never happen."
) )
@@ -470,7 +471,9 @@ def handle_regular_answer(
# For DM (ephemeral message), we need to create a thread via a normal message so the user can see # For DM (ephemeral message), we need to create a thread via a normal message so the user can see
# the ephemeral message. This also will give the user a notification which ephemeral message does not. # the ephemeral message. This also will give the user a notification which ephemeral message does not.
if receiver_ids: # if there is no message_ts_to_respond_to, and we have made it this far, then this is a /danswer message
# so we shouldn't send_team_member_message
if receiver_ids and message_ts_to_respond_to is not None:
send_team_member_message( send_team_member_message(
client=client, client=client,
channel=channel, channel=channel,