-
Notifications
You must be signed in to change notification settings - Fork 117
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
Conversation
connectors/src/lib/edit_distance.ts
Outdated
@@ -0,0 +1,41 @@ | |||
// Returns the Levenshtein distance between str1 and str2. |
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.
why not use eg https://github.com/gustf/js-levenshtein ?
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.
not a big fan of having this code in this repo, since It doesn't look great due to all these "expect error"
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.
Yes also likely optimized?
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.
ok I will use https://github.com/words/levenshtein-edit-distance (looks more recently maintained + the doc says it's fully typed).
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.
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) => { |
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.
nit: maybe no need to sort the whole array if we only need the max ?
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.
Agreed we can store the max as we push. But no big deal
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.
stored the max. thanks.
if (mentions.length === 0) { | ||
mentions.push({ assistantId: "dust", assistantName: "dust" }); | ||
} | ||
// for now we support only one mention. |
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.
Why ?
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.
Oh right only streaming answer 👍
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.
a few questions / comments / nits, super exciting !
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.
Let's use a library especially if we convince ourselves that it'll be faster?
connectors/src/lib/edit_distance.ts
Outdated
@@ -0,0 +1,41 @@ | |||
// Returns the Levenshtein distance between str1 and str2. |
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.
Yes also likely optimized?
distance: distance, | ||
}); | ||
} | ||
scores.sort((a, b) => { |
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.
Agreed we can store the max as we push. But no big deal
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.
LGTM
Can we remove all unused mentions before we merge this one. In case you want to handle multi-mention in a separate PR?
No description provided.