mirror of
https://github.com/leon-ai/leon.git
synced 2025-01-03 06:06:06 +03:00
feat(server): trigger next action suggestions or current ones
This commit is contained in:
parent
7134c9dbc1
commit
244d08c0bd
@ -40,7 +40,7 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"next_action": "guess"
|
||||
"next_action": "setup"
|
||||
},
|
||||
"setup": {
|
||||
"type": "logic",
|
||||
|
@ -4,43 +4,11 @@
|
||||
import utils
|
||||
from ..lib import akinator, db
|
||||
|
||||
# TODO: emit suggestion on each question of the loop
|
||||
# TODO: catch network error
|
||||
# TODO: timeout on question/answer
|
||||
|
||||
def guess(params):
|
||||
utils.output('inter', 'calling_akinator')
|
||||
|
||||
session = db.get_session()
|
||||
|
||||
if '"step":"0"' in session['response']:
|
||||
slots, lang = params['slots'], params['lang']
|
||||
thematic = slots['thematic']['resolution']['value']
|
||||
theme_lang = lang
|
||||
if thematic != 'characters':
|
||||
theme_lang = lang + '_' + thematic
|
||||
|
||||
aki = akinator.Akinator()
|
||||
|
||||
q = aki.start_game(theme_lang)
|
||||
|
||||
db.upsert_session({
|
||||
'response': aki.response,
|
||||
'session': aki.session,
|
||||
'progression': aki.progression,
|
||||
'signature': aki.signature,
|
||||
'uri': aki.uri,
|
||||
'timestamp': aki.timestamp,
|
||||
'server': aki.server,
|
||||
'child_mode': aki.child_mode,
|
||||
'frontaddr': aki.frontaddr,
|
||||
'question_filter': aki.question_filter
|
||||
})
|
||||
|
||||
return utils.output('end', q, { 'showSuggestions': True })
|
||||
|
||||
|
||||
print('HEREEE')
|
||||
"""Guess according to the given thematic"""
|
||||
|
||||
resolvers = params['resolvers']
|
||||
answer = None
|
||||
|
@ -32,4 +32,4 @@ def setup(params):
|
||||
'question_filter': aki.question_filter
|
||||
})
|
||||
|
||||
return utils.output('end', q)
|
||||
return utils.output('end', q, { 'showNextActionSuggestions': True })
|
||||
|
Loading…
Reference in New Issue
Block a user