supriya
supriya

Reputation: 57

watson chatbot dialog flow not hitting child node

ibm dialog flow

Please take a look at the images. The response that I am getting on IBM UI side is not showing in the Java console. It is empty or null, but the intent is hit correctly.

I am developing a chatbot using the java watson conversation api, but I am facing an error while hitting the child node. Is it a context issue or something else? I am not able to figure it out. I attached the code.

Please help.

input_gui is user input

MessageRequest newMessage = new 
MessageRequest.Builder().inputText(input_gui).context(context).build();
MessageResponse response = conversationService.message(workspaceId, newMessage).execute();

    newMessage = new MessageRequest.Builder()
            .inputText(input_gui)
            .context(response.getContext()) // output context from the first message
            .build();
    System.out.println("watson response"+response);

Please look at image i am attaching. This image is .......

Upvotes: 0

Views: 814

Answers (2)

supriya
supriya

Reputation: 57

Here is working code I got my error I called service credential every time so context get initialize on every input message that why I am not able to get single conversation id in conversation now it's working

MessageRequest newMessage = new MessageRequest.Builder().inputText(input).context(context).build();

MessageResponse response = service.message(WORKSPACE_ID,newMessage).execute();

context = response.getContext();

System.out.println(response);

Upvotes: 1

Sayuri Mizuguchi
Sayuri Mizuguchi

Reputation: 5338

I'm not one expert in Java but, trying to help you, check the Java SDK examples for Watson Conversation. You can check out this project from IBM Developers, they are using Conversation Service with Java.

See the code that I did a few months ago for one test:

MessageRequest.Builder messageRequestBuilder = new MessageRequest.Builder();
        messageRequestBuilder.inputText(input_gui);
        messageRequestBuilder.context(question.context); //this context comes from a previous step 


ServiceCall<MessageResponse> response = conversationService.message(workspaceId, messageRequestBuilder.build());
        MessageResponse mAnswer =  response.execute();

        Object textObject = mAnswer.getOutput().get("text");

Upvotes: 0

Related Questions