Merge pull request #1672 from danswer-ai/add-groups-to-slack-bot-responses

add slack groups to user response list
This commit is contained in:
hagen-danswer
2024-06-24 15:10:12 -07:00
committed by GitHub
8 changed files with 64 additions and 13 deletions

View File

@@ -71,9 +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_team_member_list ?? []
).concat(
existingSlackBotConfig?.channel_config
?.respond_slack_group_list ?? []
),
still_need_help_enabled:
existingSlackBotConfig?.channel_config?.follow_up_tags !==
undefined,
@@ -101,7 +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_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()),
@@ -116,8 +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_member_group_list.filter(
(slackGroupName) =>
!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(slackGroupName)
),
usePersona: usingPersonas,
};
@@ -227,14 +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.`}
out the occasional incorrect answer. Group names are case sensitive.`}
values={values}
/>
<Divider />

View File

@@ -14,6 +14,7 @@ interface SlackBotConfigCreationRequest {
respond_tag_only: boolean;
respond_to_bots: boolean;
respond_team_member_list: string[];
respond_slack_group_list: string[];
follow_up_tags?: string[];
usePersona: boolean;
response_type: SlackBotResponseType;
@@ -40,6 +41,7 @@ const buildRequestBodyFromCreationRequest = (
respond_tag_only: creationRequest.respond_tag_only,
respond_to_bots: creationRequest.respond_to_bots,
respond_team_member_list: creationRequest.respond_team_member_list,
respond_slack_group_list: creationRequest.respond_slack_group_list,
answer_filters: buildFiltersFromCreationRequest(creationRequest),
follow_up_tags: creationRequest.follow_up_tags?.filter((tag) => tag !== ""),
...(creationRequest.usePersona

View File

@@ -475,6 +475,7 @@ export interface ChannelConfig {
respond_tag_only?: boolean;
respond_to_bots?: boolean;
respond_team_member_list?: string[];
respond_slack_group_list?: string[];
answer_filters?: AnswerFilterOption[];
follow_up_tags?: string[];
}