combined the input fields

This commit is contained in:
hagen-danswer 2024-06-20 11:48:14 -07:00
parent 694e9e8679
commit 287a706e89
2 changed files with 21 additions and 26 deletions

View File

@ -278,10 +278,12 @@ def handle_message(
if respond_slack_group_list:
user_ids, _ = fetch_userids_from_groups(respond_slack_group_list, client)
send_to = (send_to + user_ids) if send_to else user_ids
if send_to:
send_to = list(set(send_to)) # remove duplicates
# If configured to respond to team members only, then cannot be used with a /DanswerBot command
# which would just respond to the sender
if respond_team_member_list and is_bot_msg:
if (respond_team_member_list or respond_slack_group_list) and is_bot_msg:
if sender_id:
respond_in_thread(
client=client,
@ -454,7 +456,7 @@ def handle_message(
# 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.
if respond_team_member_list:
if respond_team_member_list or respond_slack_group_list:
respond_in_thread(
client=client,
channel=channel,
@ -599,7 +601,7 @@ def handle_message(
# 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.
if respond_team_member_list:
if respond_team_member_list or respond_slack_group_list:
respond_in_thread(
client=client,
channel=channel,

View File

@ -71,12 +71,13 @@ export const SlackBotCreationForm = ({
existingSlackBotConfig?.channel_config?.respond_tag_only || false,
respond_to_bots:
existingSlackBotConfig?.channel_config?.respond_to_bots || false,
respond_team_member_list:
respond_member_group_list: (
existingSlackBotConfig?.channel_config
?.respond_team_member_list || ([] as string[]),
respond_slack_group_list:
?.respond_team_member_list ?? []
).concat(
existingSlackBotConfig?.channel_config
?.respond_slack_group_list || ([] as string[]),
?.respond_slack_group_list ?? []
),
still_need_help_enabled:
existingSlackBotConfig?.channel_config?.follow_up_tags !==
undefined,
@ -104,8 +105,7 @@ export const SlackBotCreationForm = ({
questionmark_prefilter_enabled: Yup.boolean().required(),
respond_tag_only: Yup.boolean().required(),
respond_to_bots: Yup.boolean().required(),
respond_team_member_list: Yup.array().of(Yup.string()).required(),
respond_slack_group_list: Yup.array().of(Yup.string()).required(),
respond_member_group_list: Yup.array().of(Yup.string()).required(),
still_need_help_enabled: Yup.boolean().required(),
follow_up_tags: Yup.array().of(Yup.string()),
document_sets: Yup.array().of(Yup.number()),
@ -120,11 +120,13 @@ export const SlackBotCreationForm = ({
channel_names: values.channel_names.filter(
(channelName) => channelName !== ""
),
respond_team_member_list: values.respond_team_member_list.filter(
(teamMemberEmail) => teamMemberEmail !== ""
respond_team_member_list: values.respond_member_group_list.filter(
(teamMemberEmail) =>
/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(teamMemberEmail)
),
respond_slack_group_list: values.respond_slack_group_list.filter(
(slackGroupName) => slackGroupName !== ""
respond_slack_group_list: values.respond_member_group_list.filter(
(slackGroupName) =>
!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(slackGroupName)
),
usePersona: usingPersonas,
};
@ -234,23 +236,14 @@ export const SlackBotCreationForm = ({
subtext="If not set, DanswerBot will always ignore messages from Bots"
/>
<TextArrayField
name="respond_team_member_list"
label="Team Members Emails"
name="respond_member_group_list"
label="Team Member Emails Or Slack Group Names"
subtext={`If specified, DanswerBot responses will only be
visible to members in this list. This is
visible to the members or groups in this list. This is
useful if you want DanswerBot to operate in an
"assistant" mode, where it helps the team members find
answers, but let's them build on top of DanswerBot's response / throw
out the occasional incorrect answer.`}
values={values}
/>
<TextArrayField
name="respond_slack_group_list"
label="Slack Group Names"
subtext={`If specified, DanswerBot responses will only be
visible to slack groups in this list. This is
useful if you want DanswerBot to operate in an
"assistant" mode.`}
out the occasional incorrect answer. Group names are case sensitive.`}
values={values}
/>
<Divider />