Dialogflow v2 Java客户端库检测与Spring引导:未找到项目的DesignTimeAgent

Dialogflow v2 Java客户端库检测与Spring引导:未找到项目的DesignTimeAgent,java,spring-boot,google-api,dialogflow-es,Java,Spring Boot,Google Api,Dialogflow Es,在尝试从文本中检测时,我收到以下异常(项目id已被替换)。在google中找不到与DesignTimeAgent问题相关的任何内容。感谢您的帮助 例外情况: There was an unexpected error (type=Internal Server Error, status=500). io.grpc.StatusRuntimeException: NOT_FOUND: com.google.apps.framework.request.NotFoundException: No

在尝试从文本中检测时,我收到以下异常(项目id已被替换)。在google中找不到与DesignTimeAgent问题相关的任何内容。感谢您的帮助

例外情况:

There was an unexpected error (type=Internal Server Error, status=500).
io.grpc.StatusRuntimeException: NOT_FOUND: com.google.apps.framework.request.NotFoundException: No DesignTimeAgent found for project 'MY_PROJECT_ID'.
com.google.api.gax.rpc.NotFoundException: io.grpc.StatusRuntimeException: NOT_FOUND: com.google.apps.framework.request.NotFoundException: No DesignTimeAgent found for project 'MY_PROJECT_ID'.
    at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:45)
    at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
    at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
    at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:95)
    at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:61)
    at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1015)
    at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
    at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1137)
    at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:957)
    at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:748)
    at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:493)
    at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:468)
    at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
    at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
    at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
    at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:684)
    ...
    Suppressed: com.google.api.gax.rpc.AsyncTaskException: Asynchronous task failed
        at com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:57)
        at com.google.api.gax.rpc.UnaryCallable.call(UnaryCallable.java:112)
        at com.google.cloud.dialogflow.v2.SessionsClient.detectIntent(SessionsClient.java:245)
        at com.google.cloud.dialogflow.v2.SessionsClient.detectIntent(SessionsClient.java:184)
        at com.my.microservices.controllers.DialogFlowRestController.test(DialogFlowRestController.java:35)
        ...
Caused by: io.grpc.StatusRuntimeException: NOT_FOUND: com.google.apps.framework.request.NotFoundException: No DesignTimeAgent found for project 'MY_PROJECT_ID'.
    at io.grpc.Status.asRuntimeException(Status.java:533)
    ... 23 more
Rest控制器触发
detectinent
测试(as):

包com.my.microservices.controllers;
导入com.google.cloud.dialogflow.v2.*;
导入org.slf4j.Logger;
导入org.slf4j.LoggerFactory;
导入org.springframework.http.MediaType;
导入org.springframework.web.bind.annotation.*;
导入javax.servlet.http.HttpServletRequest;
导入java.util.UUID;
@RestController
@请求映射(“/api”)
公共类对话框FlowRestController{
私有静态最终记录器Logger=LoggerFactory.getLogger(DialogFlowRestController.class);
私有字符串userText=“柏林今日天气预报”;
私有最终字符串LANG_CODE=“en US”;
私有最终字符串PROJECT_ID=System.getenv().get(“谷歌云项目”);
私有字符串sessionId=UUID.randomUUID().toString();
@GetMapping(value=“/test”,products=MediaType.APPLICATION\u JSON\u value)
@应答器
public String test()引发异常{
logger.info(“调用测试”);
try(sessionclient sessionclient=sessionclient.create()){
SessionName session=SessionName.of(项目ID,sessionId);
TextInput.Builder TextInput=TextInput.newBuilder().setText(userText).setLanguageCode(LANG_代码);
QueryInput QueryInput=QueryInput.newBuilder().setText(textInput.build();
DetectinentResponse response=SessionClient.Detectinent(会话,queryInput);
返回response.toString();
}
}
}
提供的环境变量:

GOOGLE\u CLOUD\u PROJECT=MY\u PROJECT\u ID
GOOGLE_应用程序_凭据=/Users/me/.my/pk.json
Spring Boot
pom.xml


4.0.0
org.springframework.boot
spring启动程序父级
2.1.6.1发布
com.my.microservices
对话流测试
0.0.1-快照
对话流测试
带有对话框流的演示项目
1.8
org.springframework.boot
弹簧靴起动器执行器
org.springframework.boot
SpringBootStarterWeb
com.google.api
谷歌api服务对话流
v2-rev81-1.25.0
com.google.cloud
谷歌云对话流
0.103.0-alpha
org.springframework.boot
springbootmaven插件

好的,我已经弄明白了

上述误导性错误消息是由于使用了错误的项目ID造成的。我的错误是,首先我创建了一个带有服务帐户的新项目,授予它dialogflow API权限,然后我尝试使用它的名称和相关PK JSON来调用
Detectinent
。但它没有与Dialogflow项目ID链接


因此,为了解决这个问题,我从一个默认的项目ID开始,这个ID是给我的新Dialogflow代理的,按照说明,我创建了一个新的项目,其中包含一个适合我的Dialogflow代理的服务帐户。

还尝试了
curl
。相同的错误消息:``curl-X POST \-H“Authorization:Bearer”$(gcloud auth应用程序默认打印访问令牌)\-H“内容类型:application/json;charset=utf-8”\-d@request.json \{“错误”:{“代码”:404,“消息”:“com.google.apps.framework.request.NotFoundException:未找到项目“MY\u项目ID”的DesignTimeAgent。”,“状态”:“未找到”}}``谢谢!您的页面帮助我让我的连接工作,虽然意图仍然只给我“默认意图”。不知道为什么它不能识别!