如何彻底结束谈话?

时间:2019-07-09 07:18:31

标签: java grpc google-assistant-sdk google-assist-api

我正在使用通过最新的Embedded_assistant.proto生成的GRPC使用Google助手服务

我在Google Assistant API上遇到了100%错误-即使我的应用程序可以正常运行,但我还是认为由于操作不当而导致的错误。

有人可以建议如何正确结束对话吗?

Google Assistant API报告由以下方法引起的错误:

enter image description here

public io.grpc.stub.StreamObserver<com.google.assistant.embedded.v1alpha2.AssistRequest> assist(
    io.grpc.stub.StreamObserver<com.google.assistant.embedded.v1alpha2.AssistResponse> responseObserver) {
  return asyncUnimplementedStreamingCall(METHOD_ASSIST, responseObserver);
}

这是我开始和结束对话的方式(基于示例):

public void startConversation() {
    mConversationHandler.removeCallbacksAndMessages(null);
    mRequestHandler.post(() -> mRequestCallback.onRequestStart());
    mAssistantHandler.post(() -> {

        DialogStateIn.Builder dialogStateInBuilder = DialogStateIn.newBuilder();
        getLocation();
        if (mDeviceLocation != null) {
            dialogStateInBuilder.setDeviceLocation(mDeviceLocation);
        }
        dialogStateInBuilder.setLanguageCode(mLanguageCode);

        AssistConfig.Builder assistConfigBuilder = AssistConfig.newBuilder()
                .setAudioInConfig(mAudioInConfig)
                .setAudioOutConfig(mAudioOutConfig)
                .setDeviceConfig(mDeviceConfig);
        if (mScreenOutConfig != null) {
            assistConfigBuilder.setScreenOutConfig(mScreenOutConfig);
        }
        assistConfigBuilder.setDialogStateIn(dialogStateInBuilder.build());

        mAssistantRequestObserver = mAssistantService.assist(mAssistantResponseObserver);

        mAssistantRequestObserver.onNext(
                AssistRequest.newBuilder()
                        .setConfig(assistConfigBuilder.build())
                        .build());
    });
}


public void stopConversation() {
    mAssistantRequestObserver = null;
    mConversationHandler.removeCallbacksAndMessages(null);
    mConversationHandler.post(() -> mConversationCallback.onConversationFinished());
}

还可以从Google控制台获取此错误详细信息吗?

0 个答案:

没有答案