【发布时间】:2020-01-23 08:52:31
【问题描述】:
我正在移植到 DialogFlow V2,并想尝试一下代理版本。在这里阅读:https://cloud.google.com/dialogflow/docs/agents-versions
问题是我不知道这会如何影响凭据配置,因为我无法在客户端库中找到任何内容。我目前用于身份验证的代码是
public DialogFlowEngine(DialogFlowConfig config) throws IOException {
this.config = config;
GoogleCredentials credentials = GoogleCredentials.fromStream(
new ByteArrayInputStream(config.getClientCredentials().getBytes())
);
this.sessionSettings =
SessionsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credentials))
.build();
this.projectId = ((ServiceAccountCredentials)credentials).getProjectId();
}
那么在创建会话时:
try (SessionsClient sessionsClient = SessionsClient.create(this.sessionSettings)) {
SessionName session = SessionName.of(projectId, requestId);
...
我已经看到,如果我想通过 RAW 休息端点使用代理版本控制功能,我必须发布到像 "https://dialogflow.googleapis.com/v2beta1/projects/small-talk-dfghk/agent/environments/development/users/-/sessions/e5472b8a-9feb-43f1-8213-648215960d22:detectIntent" 这样的网址
但是从 api 的外观看来,这样的操作似乎无法执行,因为他反编译的 SessionName 类与这样的 URL 匹配:
private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/agent/sessions/{session}");
有什么办法可以做到吗?否则,您如何建议在环境(开发、质量保证、暂存、产品...)之间配置 DialogFlow?
即使我有正确的 API 调用,我仍然想知道......不同的代理版本是否意味着我们可以在每个环境中拥有不同的 Json 凭据?
感谢您的帮助!
【问题讨论】:
标签: java dialogflow-es