-
Notifications
You must be signed in to change notification settings - Fork 4
Repair slack query #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request introduces improvements to the Slack integration, focusing on channel name matching and asynchronous operations in the SlackClient class.
- Implemented Levenshtein distance-based channel name matching in
backend/app/connectors/client/slack.pyto handle slightly incorrect user inputs - Added asynchronous methods
get_all_channel_names()and_repair_channel_names()in SlackClient for improved channel name handling - Updated
backend/app/sandbox/integrations/slack.pyto use async operations, removing agent-based test code - Modified
backend/app/utils/levenshtein.pyto return the original string when no close match is found, potentially affecting error handling
3 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings
| for channel in channels | ||
| if channel["name"].lower() | ||
| in request_channel_names_set # Slack channel names are always lower case | ||
| if channel["name"] in request.channel_names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: This comparison is now case-sensitive. Ensure this is intended behavior
| async def _repair_channel_names( | ||
| self, request: SlackGetChannelIdRequest | ||
| ) -> SlackGetChannelIdRequest: | ||
| possible_channel_names: list[str] = await self.get_all_channel_names() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: This call might be redundant if get_all_channel_ids() already fetched the channel list
| if ratio(most_similar, target) < THRESHOLD: | ||
| return None | ||
| return target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: This change could lead to unexpected behavior in calling code that expects None for no match. Ensure all usages of this function are updated accordingly.
No description provided.