【发布时间】:2018-05-07 14:57:41
【问题描述】:
我正在使用带有 Python API 的 DF,这是代码,我无法使用检测意图文本。
如果我使用第二行,我会收到下一个错误: google.api_core.exceptions.PermissionDenied:“projects/newagent/agent”上的 403 IAM 权限“dialogflow.sessions.detectIntent”被拒绝。
如果我使用第一个: google.api_core.exceptions.InvalidArgument:400 资源名称 'projects/newagent/agent/environments/draft/users//agent/sessions/5276b6d4-a0b6-4e91-84d3-16512d1f3299' 不匹配 'projects//agent /environments//users//sessions/'。
我已在 Google Cloud 上启用结算功能,并且用户拥有所有者权限。出了什么问题?
def detect_intent_texts(project_id, session_id, texts, language_code):
session_client = dialogflow_v2.SessionsClient()
#----------------------------------------------------------Lines that I talk about in the question---------------------------------------------------------------------------------------------------
#session = session_client.session_path(project_id, session_id)
session = "projects/newagent/agent/environments/draft/users/<user id>/sessions/6344a857-9de5-406c-ba0f-c71b7b3ffdba"
#----------------------------------------------------------Lines that I talk about in the question---------------------------------------------------------------------------------------------------
for text in texts:
text_input = dialogflow_v2.types.TextInput(text=text, language_code=language_code)
query_input = dialogflow_v2.types.QueryInput(text=text_input)
response = session_client.detect_intent(session=session, query_input=query_input)
detect_intent_texts("newagent/agent/environments/draft/users/<User Number>",str(uuid.uuid4()),"Que tal?","es-ES")
【问题讨论】:
标签: python google-cloud-platform chatbot dialogflow-es