Skip to content
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

Add support for Slack mentions #1976

Merged
merged 3 commits into from
Oct 5, 2023
Merged

Add support for Slack mentions #1976

merged 3 commits into from
Oct 5, 2023

Conversation

lasryaric
Copy link
Contributor

No description provided.

@lasryaric lasryaric requested review from spolu and fontanierh October 5, 2023 14:17
@@ -0,0 +1,41 @@
// Returns the Levenshtein distance between str1 and str2.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big fan of having this code in this repo, since It doesn't look great due to all these "expect error"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes also likely optimized?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I will use https://github.com/words/levenshtein-edit-distance (looks more recently maintained + the doc says it's fully typed).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok the code of this one is not typed neither. I think it's fine to have that. I could not find one properly typed implementation.

distance: distance,
});
}
scores.sort((a, b) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe no need to sort the whole array if we only need the max ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed we can store the max as we push. But no big deal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stored the max. thanks.

if (mentions.length === 0) {
mentions.push({ assistantId: "dust", assistantName: "dust" });
}
// for now we support only one mention.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right only streaming answer 👍

Copy link
Contributor

@fontanierh fontanierh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few questions / comments / nits, super exciting !

Copy link
Contributor

@spolu spolu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use a library especially if we convince ourselves that it'll be faster?

@@ -0,0 +1,41 @@
// Returns the Levenshtein distance between str1 and str2.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes also likely optimized?

connectors/src/connectors/slack/bot.ts Outdated Show resolved Hide resolved
distance: distance,
});
}
scores.sort((a, b) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed we can store the max as we push. But no big deal

spolu
spolu previously approved these changes Oct 5, 2023
Copy link
Contributor

@spolu spolu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Can we remove all unused mentions before we merge this one. In case you want to handle multi-mention in a separate PR?

@lasryaric lasryaric merged commit 7a4c74b into main Oct 5, 2023
@lasryaric lasryaric deleted the aric-slack_mentions branch October 5, 2023 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants