Dialogflow batchUpdate报错:Agent不支持语言'pl'求解决方案
问题:Dialogflow batchUpdate() 报错“Agent does not support language: 'pl'”
我已经花了两小时尝试修复这个错误并做了相关研究,有没有人遇到过类似问题?感谢解答。我正在用Node.js后端对接Dialogflow创建对话会话,现在卡在了batchUpdate()方法上,相关代码如下:
} else { event.contents.forEach((content: IDialogContent) => { const intent: IIntent = { name: content.intent.intentId, displayName: content.intent.intentName, webhookState: 0, inputContextNames: [ `projects/${projectId}/agent/sessions/${sessionId}/contexts/disable`, ], outputContexts: [], }; intents.push(intent); }); } }); const finalResult = await batchUpdate(projectId, intents) // 问题出在这一行 return finalResult; };
报错信息如下:
Error: 3 INVALID_ARGUMENT: com.google.apps.framework.request.BadRequestException: Agent does not support language: 'pl'. at Object.callErrorFromStatus (/app/node_modules/@grpc/grpc-js/src/call.ts:81:24) at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/src/client.ts:338:36) at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34) at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48) at /app/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24 at processTicksAndRejections (internal/process/task_queues.js:75:11) { code: 3, details: "com.google.apps.framework.request.BadRequestException: Agent does not support language: 'pl'.", metadata: Metadata { internalRepr: Map(1) { 'grpc-server-stats-bin' => [Array] }, options: {} }, note: 'Exception occurred in retry method that was not classified as transient' }
解决方案
- 检查Dialogflow Agent的语言配置:登录Dialogflow控制台,进入Agent设置页面,查看“语言”列表是否包含波兰语(pl)。如果没有,添加该语言后重试。
- 确认batchUpdate调用的语言参数:如果你的Agent未配置波兰语,需要将调用batchUpdate时使用的语言代码改为Agent支持的语言(比如'en');如果确实需要使用波兰语,确保Agent已经开启该语言支持。
- 排查自定义batchUpdate函数:如果batchUpdate是你自己封装的函数,检查内部是否默认传递了语言参数'pl',如果是,修改为Agent支持的语言代码。
内容的提问来源于stack exchange,提问作者Poj Teerapord Saelin
相关产品推荐
相关产品推荐

