1
1
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:
louistiti 2022-07-13 22:51:10 +08:00
parent 7134c9dbc1
commit 244d08c0bd
No known key found for this signature in database
GPG Key ID: 7ECA3DD523793FE6
3 changed files with 3 additions and 35 deletions

View File

@ -40,7 +40,7 @@
}
}
],
"next_action": "guess"
"next_action": "setup"
},
"setup": {
"type": "logic",

View File

@ -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

View File

@ -32,4 +32,4 @@ def setup(params):
'question_filter': aki.question_filter
})
return utils.output('end', q)
return utils.output('end', q, { 'showNextActionSuggestions': True })