我正在创建一个聊天机器人,它模仿呼叫中的ivr。例如,当用户说嗨(欢迎意图)时,我会发送一条信息,比如请从下面选择一个选项。你知道吗
1, 2, 3, 4, 5 (every option gives user a unique information)
然后我创建了一个后续的欢迎意图Default welcome intent select.number
在这种情况下,当用户键入2时,我会给他另一组选项。 从下面选择选项
a, b, c, d, e, f
例如,对于用户类型a
,我需要在dialogflow上创建什么意图来进一步处理。你知道吗
我正在使用python脚本截取用户回复
从python脚本调用dialogflow。你知道吗
reply, intent, parameter = fetch_reply(x, session_id)
def fetch_reply(query, session_id):
response = detect_intent_from_text(query, session_id)
inetnt = response.intent.display_name
# print(inetnt)
# print('-----')
value = 0.0
try:
if response.parameters['number']:
value = response.parameters['number'][0]
except ValueError:
print('no value found')
return response.fulfillment_text, inetnt, value
从这里我可以简单地使用if else
,如果用户选择a
,然后给他回复,但是dialogflow提供了什么我可以用来给用户输入的答案。你知道吗
也有一个选项,用户喜欢按0返回主菜单。 我怎么处理?你知道吗
如果你想让我提供任何其他信息,请让我知道。你知道吗
一种可能的方法是为每个可能的选项{1,2,3..a,b,c}创建意图,并在每个回复之后将它们作为建议包含在中。例如,当用户说“嗨”时,你可以用1,2,3回答“你好”。。。作为可选择的建议。当用户选择1时,a,b,c。。。作为建议出现。下面是一些代码可以帮助您:
相关问题 更多 >
编程相关推荐