mirror of
https://github.com/leon-ai/leon.git
synced 2024-09-19 22:07:10 +03:00
refactor(server): split anonymous collaborative logger request
This commit is contained in:
parent
8a33980260
commit
f4d782b69e
@ -121,6 +121,26 @@ class Nlu {
|
||||
return { }
|
||||
}
|
||||
|
||||
/**
|
||||
* Collaborative logger request
|
||||
*/
|
||||
sendLog (utterance) {
|
||||
/* istanbul ignore next */
|
||||
if (process.env.LEON_LOGGER === 'true' && process.env.LEON_NODE_ENV !== 'testing') {
|
||||
this.request
|
||||
.post('https://logger.getleon.ai/v1/expressions')
|
||||
.set('X-Origin', 'leon-core')
|
||||
.send({
|
||||
version,
|
||||
utterance,
|
||||
lang: this.brain.lang,
|
||||
classification: this.nluResultObj.classification
|
||||
})
|
||||
.then(() => { /* */ })
|
||||
.catch(() => { /* */ })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge spaCy entities with the current NER instance
|
||||
*/
|
||||
@ -358,24 +378,9 @@ class Nlu {
|
||||
return resolve(this.switchlanguage(utterance, locale, opts))
|
||||
}
|
||||
|
||||
// TODO: method
|
||||
/* istanbul ignore next */
|
||||
if (process.env.LEON_LOGGER === 'true' && process.env.LEON_NODE_ENV !== 'testing') {
|
||||
this.request
|
||||
.post('https://logger.getleon.ai/v1/expressions')
|
||||
.set('X-Origin', 'leon-core')
|
||||
.send({
|
||||
version,
|
||||
utterance,
|
||||
lang: this.brain.lang,
|
||||
classification: this.nluResultObj.classification
|
||||
})
|
||||
.then(() => { /* */ })
|
||||
.catch(() => { /* */ })
|
||||
}
|
||||
this.sendLog()
|
||||
|
||||
if (intent === 'None') {
|
||||
// TODO: method
|
||||
const fallback = this.fallback(langs[lang.getLongCode(locale)].fallbacks)
|
||||
|
||||
if (fallback === false) {
|
||||
|
Loading…
Reference in New Issue
Block a user