首页 > 解决方案 > “请切换到 'us-east1-dialogflow.googleapis.com' 以访问位于 'us-east1' 中的资源” Dialogflow CX GO API V3

问题描述

我正在尝试使用 RPC DetectIntent 方法与 Dialogflow CX 代理进行交互,但我收到错误消息“请切换到 'us-east1-dialogflow.googleapis.com' 以访问位于 'us-east1' 中的资源”。

我的代理位于“us-east1”。我提供给 API 的会话路径采用以下格式:“projects/myproject/locations/us-east1/agents/my-agent-id/sessions/mysessionid

我的进口是:

cx“cloud.google.com/go/dialogflow/cx/apiv3”

cxpb“goolge.golang.org/genproto/goolgeapis/cloud/dialogflow/cx/v3”

我使用类似的会话路径在 Python 中工作,我不明白 GO API 想要什么。谁能告诉我这个错误是什么意思?

标签: dialogflow-cx

解决方案


我想到了。它指的是端点 ID。需要使用引用该位置的端点 ID 创建代理。

dialogflow.NewSessionsClient(ctx, option.WithEndpoint("us-east1-dialogflow.googleapis.com:443"))


推荐阅读