mirror of
https://github.com/leon-ai/leon.git
synced 2024-09-20 06:17:20 +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 { }
|
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
|
* Merge spaCy entities with the current NER instance
|
||||||
*/
|
*/
|
||||||
@ -358,24 +378,9 @@ class Nlu {
|
|||||||
return resolve(this.switchlanguage(utterance, locale, opts))
|
return resolve(this.switchlanguage(utterance, locale, opts))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: method
|
this.sendLog()
|
||||||
/* 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(() => { /* */ })
|
|
||||||
}
|
|
||||||
|
|
||||||
if (intent === 'None') {
|
if (intent === 'None') {
|
||||||
// TODO: method
|
|
||||||
const fallback = this.fallback(langs[lang.getLongCode(locale)].fallbacks)
|
const fallback = this.fallback(langs[lang.getLongCode(locale)].fallbacks)
|
||||||
|
|
||||||
if (fallback === false) {
|
if (fallback === false) {
|
||||||
|
Loading…
Reference in New Issue
Block a user