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

feat(server): trigger unsupported language

This commit is contained in:
louistiti 2022-03-20 18:07:16 +08:00
parent cbb48213d2
commit 1845eed71d
No known key found for this signature in database
GPG Key ID: 7ECA3DD523793FE6
3 changed files with 13 additions and 1 deletions

View File

@ -52,6 +52,11 @@
"Hey, it looks like a new language, give me a sec so I make the switch",
"You are speaking another language, let me do the switch please",
"Wow, you can speak several languages, so do I! One moment please"
],
"random_language_not_supported": [
"Sorry, I don't speak this language yet",
"You are awesome, but I can't speak this language yet",
"It looks like a language I can't understand at the moment"
]
}
}

View File

@ -12,7 +12,7 @@
},
{
"method": "GET",
"route": "/api/action/games/guess_the_number/confirm",
"route": "/api/action/games/guess_the_number/decide",
"params": []
},
{

View File

@ -111,6 +111,13 @@ class Nlu {
}
}
// Language isn't supported
if (!lang.getShortLangs().includes(locale)) {
this.brain.talk(`${this.brain.wernicke('random_language_not_supported')}.`, true)
this.brain.socket.emit('is-typing', false)
return resolve({ })
}
// Trigger language switch
if (this.brain.lang !== locale) {
const connectedHandler = async () => {