mirror of
https://github.com/leon-ai/leon.git
synced 2024-12-26 02:04:08 +03:00
feat: tmp resolvers mapping
This commit is contained in:
parent
e88495a9a9
commit
b1a332bab6
@ -20,7 +20,7 @@ def main():
|
|||||||
'current_entities': intent_obj['current_entities'],
|
'current_entities': intent_obj['current_entities'],
|
||||||
'entities': intent_obj['entities'],
|
'entities': intent_obj['entities'],
|
||||||
'current_resolvers': intent_obj['current_resolvers'],
|
'current_resolvers': intent_obj['current_resolvers'],
|
||||||
'resolvers': intent_obj['resolvers']
|
'resolvers': intent_obj['resolvers'],
|
||||||
'slots': intent_obj['slots']
|
'slots': intent_obj['slots']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +185,8 @@ class Brain {
|
|||||||
utterance: obj.utterance,
|
utterance: obj.utterance,
|
||||||
current_entities: obj.currentEntities,
|
current_entities: obj.currentEntities,
|
||||||
entities: obj.entities,
|
entities: obj.entities,
|
||||||
|
current_resolvers: obj.currentResolvers,
|
||||||
|
resolvers: obj.resolvers,
|
||||||
slots: obj.slots
|
slots: obj.slots
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ const defaultNluResultObj = {
|
|||||||
utterance: null,
|
utterance: null,
|
||||||
currentEntities: [],
|
currentEntities: [],
|
||||||
entities: [],
|
entities: [],
|
||||||
|
currentResolvers: [],
|
||||||
|
resolvers: [],
|
||||||
slots: null,
|
slots: null,
|
||||||
nluDataFilePath: null,
|
nluDataFilePath: null,
|
||||||
answers: [], // For dialog action type
|
answers: [], // For dialog action type
|
||||||
@ -159,10 +161,19 @@ class Nlu {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const processedData = await this.brain.execute(this.nluResultObj, { mute: opts.mute })
|
const processedData = await this.brain.execute(this.nluResultObj, { mute: opts.mute })
|
||||||
|
console.log('processedData', processedData)
|
||||||
const expectedItems = processedData.action.loop.expected_items.map(({ name }) => name)
|
const expectedItems = processedData.action.loop.expected_items.map(({ name }) => name)
|
||||||
// TODO: also check for resolvers, not only entities
|
// TODO: also check for resolvers, not only entities
|
||||||
const hasMatchingItem = processedData
|
const hasMatchingItem = processedData
|
||||||
.entities.filter(({ entity }) => expectedItems.includes(entity)).length > 0
|
.entities.filter(({ entity }) => expectedItems.includes(entity)).length > 0
|
||||||
|
|| processedData
|
||||||
|
.resolvers.filter(({ resolver }) => expectedItems.includes(resolver)).length > 0
|
||||||
|
|
||||||
|
console.log('expectedItems', expectedItems[0])
|
||||||
|
// TODO: only process expected_items includes resolvers
|
||||||
|
const testo = await this.nlp.process(utterance)
|
||||||
|
console.log('testo', testo)
|
||||||
|
// this.nluResultObj.resolvers = await this.resolveResolvers()
|
||||||
|
|
||||||
// Ensure expected items are in the utterance, otherwise clean context and reprocess
|
// Ensure expected items are in the utterance, otherwise clean context and reprocess
|
||||||
if (!hasMatchingItem) {
|
if (!hasMatchingItem) {
|
||||||
|
Loading…
Reference in New Issue
Block a user