操作 google alpha 上下文问题 - beta 测试人员和生产

Action google problem with context with alpha - beta testers and production

我在 google 和我的 alpha - beta 测试用户和生产版本上遇到了问题。我正在使用 Dialogflow-V2,当我在测试模式下使用我的应用程序时,使用模拟器或将我的 phone 与我的开发帐户关联时,一切正常,我没有任何问题。

但我已经用 alpha - beta 测试用户测试了我的项目。我向我的用户发送了选择加入 Link,他们可以接受成为 alpha - beta 测试人员,并且可以使用调用示例启动代理。

Welcome intent 启动正常,然后问题出现,当使用上下文时,因为在请求正文的日志中存在,但在 Fulfillment 中没有退出。

任何上下文退出。我还更改了 Array 上下文,现在我使用一个只有一个词的参数。我也有同样的问题。

package.json

{
  "name": "dialogflowCFPUPVASISTENTE",
  "description": "This is the dialogflowCFPUPVASISTENTE for a Dialogflow agents using Cloud Functions for Firebase",
  "version": "0.0.1",
  "private": true,
  "license": "Apache Version 2.0",
  "author": "Google Inc.",
  "engines": {
    "node": "8"
  },
  "scripts": {
    "start": "firebase serve --only functions:dialogflowCFPUPVASISTENTE",
    "deploy": "firebase deploy --only functions:dialogflowCFPUPVASISTENTE"
  },
  "dependencies": {
    "actions-on-google": "^2.2.0",
    "firebase-admin": "^5.13.1",
    "firebase-functions": "^2.0.2",
    "dialogflow": "^0.6.0",
    "dialogflow-fulfillment": "^0.6.0",
    "axios": "^0.18.0",
    "i18next": "^15.0.5",
    "moment": "^2.24.0",
    "crypto-js": "^4.0.0",
    "google-auth-library": "^5.10.0"
  }
} 

index.js

 const numero = agent.parameters.numero;
conole.log(numero);
console.log('prueba6666666 cursos1 context');


//prueba
let contexto_busqueda = agent.context.get('busqueda1');
console.log(contexto_busqueda);  //HERE is UNDEFINED WHEN USE TESTER PHONE
let busqueda = contexto_busqueda.parameters.busqueda;

dialogflowFirebaseFulfillment(请求正文)带有上下文 "busqueda1" 简单参数 "busqueda"

{
textPayload: "Dialogflow Request body: {"responseId":"5c2cb699-3ca5-4062-9e12-7dc31f0b15b6-eec93b43","queryResult":{"queryText":"el curso 2","action":"MasInfoIntent","parameters":{"numero":2},"allRequiredParamsPresent":true,"outputContexts":[{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/enviar_email1","lifespanCount":5,"parameters":{"idtoken":"xxxxx","palabra":"Java","palabra.original":"Java","numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/info_curso1","lifespanCount":5,"parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_web_browser","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_audio_output","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_account_linking","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_media_response_audio","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/actions_capability_screen_output","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/google_assistant_input_type_voice","parameters":{"numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/busqueda1","lifespanCount":4,"parameters":{"palabra":"Java","palabra.original":"Java","busqueda":"Java","numero":2,"numero.original":"2"}},{"name":"projects/cfpupv-ojcaew/agent/environments/__aog-36/users/-/sessions/ABwppHFnTiCqjO9DEr-LPHi2SuK1Inxq2I69iMx-SPntmFZm-1zaZZrYanmh54bQ19yDPuTpvpYlmCUyBw/contexts/__system_counters__","parameters":{"no-input":0,"no-match":0,"numero":2,"numero.original":"2"}}],"intent":{"name":"projects/cfpupv-ojcaew/agent/intents/b74cc78e-8c1c-420e-ba0d-3b6da6e18dd9","displayName":"MasInfoIntent"},"intentDetectionConfidence":1,"languageCode":"es"},"originalDetectIntentRequest":{"source":"google","version":"2","payload":{"user":{"locale":"es-ES","lastSeen":"2020-04-24T11:37:19Z","idToken":"xxxxx"
insertId: "000001-5cbd2792-582d-45b5-a99c-62c51c1daae8"
resource: {
type: "cloud_function"
labels: {3}
}
timestamp: "2020-04-24T11:37:39.685Z"
severity: "INFO"
labels: {
execution_id: "o8obosdy5d5z"
}
logName: "projects/cfpupv-ojcaew/logs/cloudfunctions.googleapis.com%2Fcloud-functions"
trace: "projects/cfpupv-ojcaew/traces/b0fb3fa3c628d8cbaef2b73c09b64775"
receiveTimestamp: "2020-04-24T11:37:40.571089537Z"
}

dialogflowFirebaseFulfillment(请求正文)带有上下文 "busqueda1" 简单参数 "busqueda" 正在工作

{
textPayload: "Dialogflow Request body: {"responseId":"a3703a6d-9fca-4e4d-91f3-ecb58212a0f3-eec93b43","queryResult":{"queryText":"el curso 3","action":"MasInfoIntent","parameters":{"numero":3},"allRequiredParamsPresent":true,"outputContexts":[{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/enviar_email1","lifespanCount":5,"parameters":{"idtoken":"xxxxx","palabra":"java","palabra.original":"java","numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/info_curso1","lifespanCount":5,"parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/actions_capability_screen_output","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/actions_capability_account_linking","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/actions_capability_media_response_audio","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/actions_capability_audio_output","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/google_assistant_input_type_voice","parameters":{"numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/busqueda1","lifespanCount":4,"parameters":{"palabra":"java","palabra.original":"java","busqueda":"java","numero":3,"numero.original":"3"}},{"name":"projects/cfpupv-ojcaew/agent/sessions/ABwppHEYyiNzdo2qmZnOOb7FKufwyuTJ6tetAC7KkGYLp7PBEleCLaO6QIrC91Ql1a9DgWormHN_HNVb8Q/contexts/__system_counters__","parameters":{"no-input":0,"no-match":0,"numero":3,"numero.original":"3"}}],"intent":{"name":"projects/cfpupv-ojcaew/agent/intents/b74cc78e-8c1c-420e-ba0d-3b6da6e18dd9","displayName":"MasInfoIntent"},"intentDetectionConfidence":1,"languageCode":"es"},"originalDetectIntentRequest":{"source":"google","version":"2","payload":{"user":{"locale":"es-ES","lastSeen":"2020-04-24T12:07:58Z","idToken":"xxxxx","userVerificationStatus":"VERIFIED"},"conversation":{"conversationId":"ABwppHEYyiNzdo2"
insertId: "000001-3770d84b-b3e1-4610-a4e1-91f9c27573a5"
resource: {
type: "cloud_function"
labels: {3}
}
timestamp: "2020-04-24T12:08:09.311Z"
severity: "INFO"
labels: {
execution_id: "0hxf6o3oumx8"
}
logName: "projects/cfpupv-ojcaew/logs/cloudfunctions.googleapis.com%2Fcloud-functions"
trace: "projects/cfpupv-ojcaew/traces/ee0e462e5b7fcab9b45d7ef9acdcebe8"
receiveTimestamp: "2020-04-24T12:08:10.552786312Z"
}

"TypeError: 无法读取未定义的 属性 'parameters' 在 masInfo (/srv/index.js:122:29) 在 WebhookClient.handleRequest (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:313:44) 在 exports.dialogflowFirebaseFulfillment.functions.https.onRequest (/srv/index.js:173:9) 在 cloudFunction (/srv/node_modules/firebase-functions/lib/providers/https.js:57:9) 在 /worker/worker.js:783:7 在 /worker/worker.js:766:11 在 _combinedTickCallback (internal/process/next_tick.js:132:7) 在 process._tickDomainCallback (internal/process/next_tick.js:219:9)"

我认为这是google云平台的权限问题。有什么想法吗?

Permissions cloud

我是否需要 alpha 测试人员和生产人员的另一个许可才能使用上下文?

https://cloud.google.com/dialogflow/docs/fulfillment-inline-editor

https://cloud.google.com/dialogflow/docs/fulfillment-webhook

如果我使用其他 alpha 测试器,该项目将无法正常工作,因为尽管对话流上下文存在于 google 云平台的请求正文中,但在程序中是未定义的。 我是否必须采取行动 google 才能在 alpha 测试或生产中使用该程序?

你能帮帮我吗?

您可能会达到 上下文的最大大小,因为您要在其中存储大量信息。我无法找到上下文的记录限制,但我认为值得尝试使用较小的参数数重现该问题以查看它是否通过。

看起来参数 "listado" 有一个 JavaScript 数组作为值。 documentation for Context parameters 表示映射中的值在某些有限的情况下应该是复合类型(即另一个映射),但通常应该是字符串。

因此,当您认为您正在设置一个数组时,当它被读回时,由于它不是一个字符串,它可能被清空或者整个上下文被认为是无效的。

操作答案Google助理支持:

感谢您提供所需信息并将我的帐户添加为 Alpha 测试人员。基于这些,我们可以理解是 "parameters" 属性 导致了 Action 崩溃。检查提供的代码片段后,我们注意到您使用了 "agent" 而不是 "conv"。您可以做的是将 "agent" 更新为 "conv"。这样做的原因是代理更多地用于 Dialogflow 的其他集成。这也是与 Dialogflow 团队协调的,他们也提出了同样的建议。请参考下面的代码片段,了解如何直接或在 webhook 的上下文中获取参数值。

// Handle the Dialogflow intent named 'Curso Intent' without context.
// The intent collects a parameter named 'numero'.
app.intent('Curso Intent', (conv, {numero}) => {
    const numero = numero;
});


// Handle the Dialogflow intent named 'Curso Intent' with context "curso_out".
// The intent collects a parameter named 'numero'.
app.intent('Curso Intent', (conv, {conv}) => {
    const cCursoOut = conv.contexts.get('curso_out');
    const pCursoOut = cCursoOut.parameters;
    const numero = pCursoOut.numero;
});

使用 'conv' 项目完美运行 !!!!!!!!!!!!!

非常感谢你