Fixed slack groups (#1814)

* Simplified slackbot response groups and fixed need more help bug

* mypy fixes

* added exceptions for the couldnt find passthrough arrays
This commit is contained in:
hagen-danswer
2024-07-13 15:34:35 -07:00
committed by GitHub
parent c7af6a4601
commit 36da2e4b27
11 changed files with 137 additions and 96 deletions

View File

@@ -79,13 +79,9 @@ export const SlackBotCreationForm = ({
existingSlackBotConfig?.channel_config?.respond_to_bots || false,
enable_auto_filters:
existingSlackBotConfig?.enable_auto_filters || false,
respond_member_group_list: (
respond_member_group_list:
existingSlackBotConfig?.channel_config
?.respond_team_member_list ?? []
).concat(
existingSlackBotConfig?.channel_config
?.respond_slack_group_list ?? []
),
?.respond_member_group_list ?? [],
still_need_help_enabled:
existingSlackBotConfig?.channel_config?.follow_up_tags !==
undefined,
@@ -133,14 +129,7 @@ export const SlackBotCreationForm = ({
channel_names: values.channel_names.filter(
(channelName) => channelName !== ""
),
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)
),
respond_member_group_list: values.respond_member_group_list,
usePersona: usingPersonas,
standard_answer_categories: values.standard_answer_categories.map(
(category) => category.id
@@ -257,13 +246,13 @@ export const SlackBotCreationForm = ({
/>
<TextArrayField
name="respond_member_group_list"
label="Team Member Emails Or Slack Group Names"
label="Team Member Emails Or Slack Group Names/Handles"
subtext={`If specified, DanswerBot responses will only be
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. Group names are case sensitive.`}
out the occasional incorrect answer. Group names and handles are case sensitive.`}
values={values}
/>
<Divider />

View File

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

View File

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