1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-11-27 08:06:03 +03:00

fix(server): fallback on global resolver during resolver classification

This commit is contained in:
louistiti 2022-07-09 18:59:25 +08:00
parent fa558a447a
commit ec77dd0f02
No known key found for this signature in database
GPG Key ID: 7ECA3DD523793FE6

View File

@ -244,14 +244,21 @@ class Nlu {
* to not overlap with resolvers from other skills
*/
if (this.conv.hasActiveContext()) {
classifications.forEach(({ intent: newIntent, score: newScore }) => {
if (newScore > 0.6) {
const classification = classifications.find(({ intent: newIntent, score: newScore }) => {
const [, skillName] = newIntent.split('.')
// Prioritize skill resolver intent
if (newScore > 0.6) {
if (this.nluResultObj.classification.skill === skillName) {
intent = newIntent
return true
}
}
// Use a global resolver if any
return skillName === 'global'
})
// eslint-disable-next-line prefer-destructuring
intent = classification.intent
}
const resolveResolvers = (resolver, intent) => {