mirror of
https://github.com/leon-ai/leon.git
synced 2024-12-25 01:31:47 +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'],
|
||||
'entities': intent_obj['entities'],
|
||||
'current_resolvers': intent_obj['current_resolvers'],
|
||||
'resolvers': intent_obj['resolvers']
|
||||
'resolvers': intent_obj['resolvers'],
|
||||
'slots': intent_obj['slots']
|
||||
}
|
||||
|
||||
|
@ -185,6 +185,8 @@ class Brain {
|
||||
utterance: obj.utterance,
|
||||
current_entities: obj.currentEntities,
|
||||
entities: obj.entities,
|
||||
current_resolvers: obj.currentResolvers,
|
||||
resolvers: obj.resolvers,
|
||||
slots: obj.slots
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ const defaultNluResultObj = {
|
||||
utterance: null,
|
||||
currentEntities: [],
|
||||
entities: [],
|
||||
currentResolvers: [],
|
||||
resolvers: [],
|
||||
slots: null,
|
||||
nluDataFilePath: null,
|
||||
answers: [], // For dialog action type
|
||||
@ -159,10 +161,19 @@ class Nlu {
|
||||
)
|
||||
|
||||
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)
|
||||
// TODO: also check for resolvers, not only entities
|
||||
const hasMatchingItem = processedData
|
||||
.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
|
||||
if (!hasMatchingItem) {
|
||||
|
Loading…
Reference in New Issue
Block a user