mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-13 06:32:57 +02:00
Default not respond to every channel(#527)
This commit is contained in:
@ -15,9 +15,7 @@ from danswer.configs.app_configs import DANSWER_BOT_ANSWER_GENERATION_TIMEOUT
|
|||||||
from danswer.configs.app_configs import DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER
|
from danswer.configs.app_configs import DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER
|
||||||
from danswer.configs.app_configs import DANSWER_BOT_DISPLAY_ERROR_MSGS
|
from danswer.configs.app_configs import DANSWER_BOT_DISPLAY_ERROR_MSGS
|
||||||
from danswer.configs.app_configs import DANSWER_BOT_NUM_RETRIES
|
from danswer.configs.app_configs import DANSWER_BOT_NUM_RETRIES
|
||||||
from danswer.configs.app_configs import (
|
from danswer.configs.app_configs import DANSWER_BOT_RESPOND_EVERY_CHANNEL
|
||||||
DANSWER_BOT_ONLY_ANSWER_WHEN_SLACK_BOT_CONFIG_IS_PRESENT,
|
|
||||||
)
|
|
||||||
from danswer.configs.app_configs import DOCUMENT_INDEX_NAME
|
from danswer.configs.app_configs import DOCUMENT_INDEX_NAME
|
||||||
from danswer.configs.app_configs import ENABLE_DANSWERBOT_REFLEXION
|
from danswer.configs.app_configs import ENABLE_DANSWERBOT_REFLEXION
|
||||||
from danswer.configs.constants import DOCUMENT_SETS
|
from danswer.configs.constants import DOCUMENT_SETS
|
||||||
@ -40,7 +38,7 @@ def handle_message(
|
|||||||
answer_generation_timeout: int = DANSWER_BOT_ANSWER_GENERATION_TIMEOUT,
|
answer_generation_timeout: int = DANSWER_BOT_ANSWER_GENERATION_TIMEOUT,
|
||||||
should_respond_with_error_msgs: bool = DANSWER_BOT_DISPLAY_ERROR_MSGS,
|
should_respond_with_error_msgs: bool = DANSWER_BOT_DISPLAY_ERROR_MSGS,
|
||||||
disable_docs_only_answer: bool = DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER,
|
disable_docs_only_answer: bool = DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER,
|
||||||
only_answer_when_config_is_present: bool = DANSWER_BOT_ONLY_ANSWER_WHEN_SLACK_BOT_CONFIG_IS_PRESENT,
|
respond_every_channel: bool = DANSWER_BOT_RESPOND_EVERY_CHANNEL,
|
||||||
) -> None:
|
) -> None:
|
||||||
engine = get_sqlalchemy_engine()
|
engine = get_sqlalchemy_engine()
|
||||||
with Session(engine) as db_session:
|
with Session(engine) as db_session:
|
||||||
@ -48,7 +46,7 @@ def handle_message(
|
|||||||
slack_bot_config = get_slack_bot_config_for_channel(
|
slack_bot_config = get_slack_bot_config_for_channel(
|
||||||
channel_name=channel_name, db_session=db_session
|
channel_name=channel_name, db_session=db_session
|
||||||
)
|
)
|
||||||
if slack_bot_config is None and only_answer_when_config_is_present:
|
if slack_bot_config is None and not respond_every_channel:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Skipping message since the channel is not configured to use DanswerBot"
|
"Skipping message since the channel is not configured to use DanswerBot"
|
||||||
)
|
)
|
||||||
|
@ -230,12 +230,12 @@ DANSWER_BOT_DISPLAY_ERROR_MSGS = os.environ.get(
|
|||||||
DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER = os.environ.get(
|
DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER = os.environ.get(
|
||||||
"DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER", ""
|
"DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER", ""
|
||||||
).lower() not in ["false", ""]
|
).lower() not in ["false", ""]
|
||||||
DANSWER_BOT_ONLY_ANSWER_WHEN_SLACK_BOT_CONFIG_IS_PRESENT = (
|
|
||||||
os.environ.get(
|
# Default is only respond in channels that are included by a slack config set in the UI
|
||||||
"DANSWER_BOT_ONLY_ANSWER_WHEN_SLACK_BOT_CONFIG_IS_PRESENT", ""
|
DANSWER_BOT_RESPOND_EVERY_CHANNEL = (
|
||||||
).lower()
|
os.environ.get("DANSWER_BOT_RESPOND_EVERY_CHANNEL", "").lower() == "true"
|
||||||
== "true"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add a second LLM call post Answer to verify if the Answer is valid
|
# Add a second LLM call post Answer to verify if the Answer is valid
|
||||||
# Throws out answers that don't directly or fully answer the user query
|
# Throws out answers that don't directly or fully answer the user query
|
||||||
# This is the default for all DanswerBot channels unless the bot is configured individually
|
# This is the default for all DanswerBot channels unless the bot is configured individually
|
||||||
|
@ -80,7 +80,7 @@ services:
|
|||||||
- DANSWER_BOT_SLACK_BOT_TOKEN=${DANSWER_BOT_SLACK_BOT_TOKEN:-}
|
- DANSWER_BOT_SLACK_BOT_TOKEN=${DANSWER_BOT_SLACK_BOT_TOKEN:-}
|
||||||
- DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER=${DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER:-}
|
- DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER=${DANSWER_BOT_DISABLE_DOCS_ONLY_ANSWER:-}
|
||||||
- DANSWER_BOT_DISPLAY_ERROR_MSGS=${DANSWER_BOT_DISPLAY_ERROR_MSGS:-}
|
- DANSWER_BOT_DISPLAY_ERROR_MSGS=${DANSWER_BOT_DISPLAY_ERROR_MSGS:-}
|
||||||
- DANSWER_BOT_ONLY_ANSWER_WHEN_SLACK_BOT_CONFIG_IS_PRESENT=${DANSWER_BOT_ONLY_ANSWER_WHEN_SLACK_BOT_CONFIG_IS_PRESENT:-}
|
- DANSWER_BOT_RESPOND_EVERY_CHANNEL=${DANSWER_BOT_RESPOND_EVERY_CHANNEL:-}
|
||||||
# Don't change the NLP model configs unless you know what you're doing
|
# Don't change the NLP model configs unless you know what you're doing
|
||||||
- DOCUMENT_ENCODER_MODEL=${DOCUMENT_ENCODER_MODEL:-}
|
- DOCUMENT_ENCODER_MODEL=${DOCUMENT_ENCODER_MODEL:-}
|
||||||
- NORMALIZE_EMBEDDINGS=${NORMALIZE_EMBEDDINGS:-}
|
- NORMALIZE_EMBEDDINGS=${NORMALIZE_EMBEDDINGS:-}
|
||||||
|
Reference in New Issue
Block a user