沃森开发者云/ Android的SDK-对话

时间:2016-11-15 14:21:53

标签: android-studio ibm-cloud ibm-watson watson-conversation

您好我指的是this Android sdk Watson语言翻译示例,并替换为Conversation Service以在Android平台上部署该应用程序。在示例代码中,他们在MainActivity.java上有一个类(下图)。如何对此特定类的对话服务的语法格式进行必要的更改?请帮忙。 enter image description here

1 个答案:

答案 0 :(得分:0)

ConversationService conversationService = new ConversationService(ConversationService.VERSION_DATE_2016_07_11, userName, password);
MessageRequest.Builder messageRequestBuilder = new MessageRequest.Builder();
messageRequestBuilder.inputText(question);
ServiceCall<MessageResponse> response = conversationService.message(workspaceId, messageRequestBuilder.build());
MessageResponse answer =  response.execute();