From 0d6a551bd938a2a955ac347b2d6c7a941a078a07 Mon Sep 17 00:00:00 2001 From: Alex Co Date: Thu, 19 Sep 2024 21:06:03 +0800 Subject: [PATCH] Hack: Try to get the correct config of the prefixed channel Signed-off-by: Alex Co --- backend/danswer/danswerbot/slack/config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/danswer/danswerbot/slack/config.py b/backend/danswer/danswerbot/slack/config.py index d7789b3d32e..1b941c623bf 100644 --- a/backend/danswer/danswerbot/slack/config.py +++ b/backend/danswer/danswerbot/slack/config.py @@ -19,9 +19,12 @@ def get_slack_bot_config_for_channel( slack_bot_configs = fetch_slack_bot_configs(db_session=db_session) for config in slack_bot_configs: - if channel_name in config.channel_config[ - "channel_names" - ] or channel_name.startswith("inc-"): + if channel_name in config.channel_config["channel_names"]: + return config + if any( + channel_name.startswith("inc-") + for channel_name in config.channel_config["channel_names"] + ): return config return None