爲核心的Java對話服務的例子做工精細的Spring MVC,沃森談話
對於Spring MVC的是顯示錯誤一樣,
"Exception in thread "main" java.lang.NoSuchMethodError: com.ibm.watson.developer_cloud.conversation.v1.ConversationService.createServiceCall(Lokhttp3/Request;Lcom/ibm/watson/developer_cloud/http/ResponseConverter;)Lcom/ibm/watson/developer_cloud/http/ServiceCall; at com.ibm.watson.developer_cloud.conversation.v1.ConversationService.message(ConversationService.java:89)"
我使用下面的例子
ConversationService service = new ConversationService(ConversationService.VERSION_DATE_2017_02_03,"username", "password");
Scanner sc = new Scanner(System.in);
String workspaceId = "workspaceId ";
String str = "open",response1;
do {
System.out.println("Start chat");
str = sc.nextLine();
MessageRequest newMessage = new MessageRequest.Builder().inputText(str).build();
MessageResponse response = service.message(workspaceId, newMessage).execute();
response1 = response.getText().toString();
System.out.println(response1.replace("[","").replace("]",""));
//System.out.println(response1);
} while(!(str.contains("bye")));