How to end a conversation with API.AI

Is there a way to end the Google Home dialog with the server using API.AI?

I am assuming that somehow I need to access expect_user_response and set it to false.

I also see that SDK actions you can use "assistant.tell ()", but this does not look like API.AI.

+4
source share
3 answers

Yes, you can. In your application, write a function that sends a “stop” request to your agent.

function stop_conversation(){ var api_request = new Request('https://api.api.ai/v1/query?v=20150910', {
        method: 'POST',
        mode: 'cors',
        redirect: 'follow',
        headers: {
            'Authorization': 'Bearer 21f6a5778d484870ad46be4d34ac2eeb',
            'content-Type': 'application/json; charset=utf-8'
        },
        body: JSON.stringify({
            q: 'stop',
            lang: 'en',
            sessionId: '44628d21-d7a4-47d5-b1c6-a7f851be65fv'
        })
    });
}

If you use the runtime library , then call Assist('stop');.

...

"" " Google", . " " .

:

data: {
  google: {
    expect_user_response: false,
  }
}

, .

+3

, SDK. , , Google API.AI.

"" " Google", . " ". .

:

data: {
  google: {
    expect_user_response: false,
  }
}

, .

+5

, Node.js, tell() (docs ActionsSdk client, docs API.AI.

:

, .

, Google Assistant.

, " " API- API.AI (, , , Intent): enter image description here

+1

Source: https://habr.com/ru/post/1664502/


All Articles