我在代码中集成了使用dialogflow v2 API的聊天机器人,但没有收到来自代理的任何响应。我在GCP上检查了post方法,并在执行中显示了上述错误。如何修复或设置不正确
我已经从密钥中检查了会话名称和要设置的项目,它们是正确的。在我的应用程序中检测意图时出现错误。在此处正确设置了queryInput和语言。
public class RequestJava extends AsyncTask<Void, Void, DetectIntentResponse> {
fragment_speak fragment;
private SessionName session;
private SessionsClient sessionsClient;
private QueryInput queryInput;
RequestJava(fragment_speak fragment, SessionName session, SessionsClient sessionsClient, QueryInput queryInput) {
this.fragment = fragment;
this.session = session;
this.sessionsClient = sessionsClient;
this.queryInput = queryInput;
}
protected DetectIntentResponse doInBackground(Void... voids) {
//try{
DetectIntentRequest detectIntentRequest =
DetectIntentRequest.newBuilder()
.setSession(session.toString())
.setQueryInput(queryInput)
.build();
Log.d("DetectIntentRequest:","Intent Is: " + detectIntentRequest );
Log.d(" Request is "," " + sessionsClient.detectIntent(detectIntentRequest));
return sessionsClient.detectIntent(detectIntentRequest);
//}
/*catch (Exception e) {
Log.d("36","In catch block");
e.printStackTrace();
}
return null;*/
}
protected void onPostExecute(DetectIntentResponse response) {
this.fragment.callbackV2(response);
}
}
这是我得到的答复。
{
"responseId": "7dfcd725-550d-4fb1-9cd3-e5a2223eda21",
"queryResult": {
"queryText": "what is your age?",
"action": "smalltalk.agent.age",
"parameters": {
"age": ""
},
"allRequiredParamsPresent": true,
"fulfillmentText": "Isn't age just a number?",
"fulfillmentMessages": [
{
"text": {
"text": [
"Isn't age just a number?"
]
}
}
],
"intent": {},
"intentDetectionConfidence": 1,
"diagnosticInfo": {
"webhook_latency_ms": 125
},
"languageCode": "en-us"
},
"webhookStatus": {
"code": 13,
"message": "Webhook call failed. Error: 500 Internal Server Error"
}
}