gpt4 book ai didi

dialogflow-es - Dialogflow 从 webhook 更改界面

转载 作者:行者123 更新时间:2023-12-02 08:41:41 24 4
gpt4 key购买 nike

我尝试从网络钩子(Hook)发送响应来触发更改到另一个界面的过程,但 Actions on Google 总是抛出异常:

MalformedResponse 'final_response' must be set.

这并不是很有帮助。

这是我返回的 JSON:

{
"payload": {
"google": {
"expectUserResponse": true,
"conversationToken": "{\"data\":{}}",
"userStorage": "{\"data\":{}}",
"expectedInputs": [
{
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "PLACEHOLDER"
}
}
]
}
},
"possibleIntents": [
{
"intent": "actions.intent.NEW_SURFACE",
"inputValueData": {
"@type": "type.googleapis.com/google.actions.v2.NewSurfaceValueSpec",
"capabilities": [
{
"name": "actions.capability.SCREEN_OUTPUT"
}
],
"context": "Sure, I have some sample images for you.",
"notificationTitle": "Sample Images"
}
}
]
}
]
}
}
}

在 Dialogflow 上,我设置了 2 个意图;一个意图返回此处指定的 json,另一个意图包含事件 actions_intent_NEW_SURFACE,因此我知道用户对更改表面问题的响应。

我一直在阅读这些网站:

https://developers.google.com/actions/assistant/surface-capabilities#multi-surface_conversations

https://dialogflow.com/docs/reference/api-v2/rest/Shared.Types/WebhookResponse

https://developers.google.com/actions/build/json/dialogflow-webhook-json#dialogflow-response-body

Action On Google, webhook response with actions.intent.NEW_SURFACE (这似乎和我有同样的问题,但OP没有写响应。)

但是他们都没有让我对这个问题有任何了解。

最佳答案

您似乎正在尝试发送完整的 Action SDK 正文作为 Dialogflow 响应的一部分。虽然 JSON 的 payload.google 部分包含与 Action SDK 响应类似的对象,但存在一些差异。您可以看到https://developers.google.com/actions/build/json/dialogflow-webhook-json#dialogflow-response-body有关使用助手时响应应该是什么的完整示例,但我认为您的响应需要类似于

{
"payload": {
"google": {
"expectUserResponse": true,
"userStorage": "{\"data\":{}}",
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "PLACEHOLDER"
}
}
]
},
"systemIntent": {
"intent": "actions.intent.NEW_SURFACE",
"inputValueData": {
"@type": "type.googleapis.com/google.actions.v2.NewSurfaceValueSpec",
"capabilities": [
"actions.capability.SCREEN_OUTPUT"
],
"context": "Sure, I have some sample images for you.",
"notificationTitle": "Sample Images"
}
}
}
}
}

关于dialogflow-es - Dialogflow 从 webhook 更改界面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52377551/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com