Websphere 使用节点红色的Watson Assistant V2时出现类型错误

Websphere 使用节点红色的Watson Assistant V2时出现类型错误,websphere,ibm-watson,node-red,watson-assistant,Websphere,Ibm Watson,Node Red,Watson Assistant,我正在为我正在建造的电报机器人设置沃森助手。好的,我知道使用Watson-assistant-v1(即助手节点)从Watson处获取答案没有问题,但是,我想使用Watson-assistant-v2(即助手节点) 我不知道我做错了什么。对于红色节点中的API键,我使用助手的API键。但是,当我在调试中向bot发送消息时,会得到“TypeError:无法读取未定义的属性“0” 我还缺什么吗?为什么会发生此错误在Assistant V1节点中,配置是工作区ID 在助手V2节点中,配置是针对助手ID的

我正在为我正在建造的电报机器人设置沃森助手。好的,我知道使用Watson-assistant-v1(即助手节点)从Watson处获取答案没有问题,但是,我想使用Watson-assistant-v2(即助手节点)

我不知道我做错了什么。对于红色节点中的API键,我使用助手的API键。但是,当我在调试中向bot发送消息时,会得到“TypeError:无法读取未定义的属性“0”


我还缺什么吗?为什么会发生此错误

在Assistant V1节点中,配置是工作区ID

在助手V2节点中,配置是针对助手ID的

对于这两种情况,输入文本都应位于
msg.payload
中,但可以为空以允许启动对话框。因此,对于V2节点,这是一个有效的流,应该可以工作

[{"id":"83dbc697.d416c8","type":"inject","z":"f551e981.a6bf78","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":260,"wires":[["d334bd1c.00abb"]]},{"id":"d334bd1c.00abb","type":"watson-assistant-v2","z":"f551e981.a6bf78","name":"","service-endpoint":"https://gateway.watsonplatform.net/assistant/api","assistant_id":"f6f33980-9b6a-4bdf-92dd-e7974a832586","debug":false,"restart":false,"return_context":true,"alternate_intents":false,"multisession":true,"timeout":"","optout-learning":false,"x":410,"y":260,"wires":[["151a548c.d4f44b","6ad0ad7b.b34414"]]},{"id":"151a548c.d4f44b","type":"debug","z":"f551e981.a6bf78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":240,"wires":[]}]
如果要设置对话框,则需要设置上下文。这两个节点都可以为您管理上下文,但它们需要上下文的标识符。对于V2节点,这是通过将
msg.params.session\u id
设置为对应用程序有意义的任意值来完成的。例如

[{"id":"b30a8bd4.e5f628","type":"inject","z":"f551e981.a6bf78","name":"","topic":"","payload":"Hello","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":300,"wires":[["4c5c73b5.eef91c"]]},{"id":"4c5c73b5.eef91c","type":"function","z":"f551e981.a6bf78","name":"","func":"msg.params = {\n    \"session_id\" : \"ABC\"\n};\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":360,"wires":[["d334bd1c.00abb"]]},{"id":"d334bd1c.00abb","type":"watson-assistant-v2","z":"f551e981.a6bf78","name":"","service-endpoint":"https://gateway.watsonplatform.net/assistant/api","assistant_id":"f6f33980-9b6a-4bdf-92dd-e7974a832586","debug":false,"restart":false,"return_context":true,"alternate_intents":false,"multisession":true,"timeout":"","optout-learning":false,"x":410,"y":260,"wires":[["151a548c.d4f44b","6ad0ad7b.b34414"]]},{"id":"151a548c.d4f44b","type":"debug","z":"f551e981.a6bf78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":240,"wires":[]}]
然后,节点为您管理会话和上下文,并在会话过期时续订会话