且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在python中向Dialogflow事件添加参数

更新时间:2023-11-30 13:24:22

找到了解决方案。 参数必须是google.protobuf.Struct,以便类似下面的内容

found the solution. parameters needs to be a google.protobuf.Struct so something like below works

from google.protobuf import struct_pb2

parameters = struct_pb2.Struct()
parameters["result_guid"] = "49A8608C-4854-4964-81C3-0A75F912B994"
event_input = dialogflow.types.EventInput(name=event_name, parameters=parameters, language_code=language_code)