innFactory / react-native-dialogflow

A React-Native Bridge for the Google Dialogflow (API.AI) SDK
https://innfactory.de/softwareentwicklung/ui-ux/sprachsteuerung-mit-api-ai-in-einer-react-native-app/
MIT License
200 stars 64 forks source link

support for v2 #24

Closed moshekr closed 6 years ago

moshekr commented 6 years ago

Hey, any plan to support dialogflow v2? in particular the streaming option

yardensk commented 6 years ago

+1

spoeck commented 6 years ago

Hi @moshekr , I will check the technical specs of dialogflow v2 and give you a road map the next days.

sk-eran commented 6 years ago

+1

HisashiQ commented 6 years ago

+1

eggybot commented 6 years ago

+1

yardensk commented 6 years ago

Hey @spoeck any update ? :) Thanks for the useful work again! 🎉

spoeck commented 6 years ago

Update: I'm working on support for v2. I will release a beta next week!

spoeck commented 6 years ago

Update:

For the REST calls for V2 I would need some help. Can someone give me a example REST POST? I don't understand the URL param ({session=projects//agent/sessions/})

eggybot commented 6 years ago

have you check this part? (check the cURL example) https://dialogflow.com/docs/reference/v2-auth-setup

I'm not totally sure on the v2 POST on the URL parameters.

spoeck commented 6 years ago

Thanks @eggybot for the auth setup link! requests with speech/text/events are working (see in the example app on android)

The link is something like this: https://dialogflow.googleapis.com/v2beta1/projects/testv2-3b5ca/agent/sessions/0:detectIntent

BUT: Contexts are NOT working. And I think there is a new mechanism. In V1 you just put the contexts into the request and everything fine. But in V2, do I have to create the contexts separatly before making a text request? Does anyone know how to use the context endpoint? https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/projects.agent.sessions.contexts/create

eggybot commented 6 years ago

I compare v1 and v2, I'm not sure if I'm correct but it looks the same but it has different session approach.

You can try and check here https://cloud.google.com/dialogflow-enterprise/docs/migrating and go to context and try the Context create here https://cloud.google.com/dialogflow-enterprise/docs/reference/rest/v2beta1/projects.agent.sessions.contexts/create it has a test/explorer tool (on the right side) and it might give you much better explanation on the result

spoeck commented 6 years ago

Ah damn !!! now I got it When you wan't to set a context for example deals, instead of setting:

{
      "name": "deals",
      "lifespan": 1
}

in V2 you have to set

{
      "name": "projects/testv2-3b5ca/agent/sessions/0/contexts/deals",
      "lifespanCount": 1
}

so I will concat the path of the name in background so that you can set the context in V2 as below:

{
      "name": "deals",
      "lifespanCount": 1
}
spoeck commented 6 years ago

Published v3.0.0 with Dialog-V2 support!

yardensk commented 6 years ago

Thanks!

rajasaur commented 6 years ago

@spoeck : You mentioned about context being reset, and thats what I get when trying your sample on a flow that has a followup intent. The base intent seems to be working fine but when i speak into the app for the followup, it seems to not take the original context. Do we need to manually setup the contexts ?

eggybot commented 6 years ago

@rajasaur can you show us your code? also do you have the Dialogflow.resetContexts somewhere in your code? that code will reset the context.

rajasaur commented 6 years ago

@eggybot , Its the same in the sample (https://github.com/innFactory/react-native-dialogflow/tree/master/example). Tried to use it against one of my simple projects which only has 2 intents -- main and a followup. The main intent got recognized properly but the followup dint.

eggybot commented 6 years ago

@rajasaur can you check the lifespan of your context in dialogflow, as well try to chat or speech chat directly on dialogflow test section (right side of intent). Then let me know if it works or not.