Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Brazil] integrate with Dialogflow CX's 'partial response' fuctionality #852

Open
ear-dev opened this issue Jul 22, 2021 · 16 comments
Open

Comments

@ear-dev
Copy link

ear-dev commented Jul 22, 2021

Alexander has described the issues involved in issue number 809..... use this as starting point for discussion.

@ear-dev ear-dev changed the title Design best way to guarantee message order in whatsApp try using CX 'partial responses' to fix out of order messages Jul 29, 2021
@ear-dev ear-dev changed the title try using CX 'partial responses' to fix out of order messages [Brazil] try using CX 'partial responses' to fix out of order messages Aug 11, 2021
@ear-dev ear-dev changed the title [Brazil] try using CX 'partial responses' to fix out of order messages [Brazil] integrate with Dialogflow CX's 'partial response' fuctionality Aug 31, 2021
@ear-dev
Copy link
Author

ear-dev commented Sep 14, 2021

Steve will check with google about an updated version of the nodejs module for the API.

If we go this route, we will need to refactor all communication between our app and the CX.agent

@ear-dev ear-dev added this to the CY21Q4 milestone Sep 16, 2021
@ear-dev
Copy link
Author

ear-dev commented Oct 5, 2021

@Shailesh351 can you look at this and concur.

@ear-dev
Copy link
Author

ear-dev commented Oct 14, 2021

@AlexanderKanakis we will go with your current strategy into production for now...... please create the other neccessary PRs to make this work, and document that here.

Also please document the effects of large responses vs. small, and how you are suggesting we use partial responses vs. normal responses on the CX.agent

@ear-dev
Copy link
Author

ear-dev commented Nov 30, 2021

@AlexanderKanakis please document you new strategy here. Include any gottchas and weird errors....

@AlexanderKanakis
Copy link
Collaborator

AlexanderKanakis commented Jan 27, 2022

PRs:

  1. RC: [FIX] Add missing function in AppActivationBridge #1072
  2. Apps.Dialogflow: [EXTEND] Parse partial responses Apps.Dialogflow#132
  3. RC.Apps-engine: Import Dialogflow CX Rocket.Chat.Apps-engine#47

Instructions:

Run npm install @rocket.chat/apps-engine in both Rocket.Chat and Apps.Dialogflow repos.

@ear-dev
Copy link
Author

ear-dev commented Feb 11, 2022

@AlexanderKanakis not sure I understand the instruction to run npm install @rocket.chat/apps-engine
Shouldn't that just be a part of the package.json in those repos?

@AlexanderKanakis
Copy link
Collaborator

@ear-dev For some reason @rocket.chat/apps-engine may not update properly if updated through the npm install or meteor npm install command. I found that installing @rocket.chat/apps-engine specifically solves the problem.

@ear-dev
Copy link
Author

ear-dev commented Feb 11, 2022

This seems odd to me...... if it's part of package.json, and one were to just delete the current node_modules directory, and the current package-lock.json, and run meteor npm install again, everything should load as described in package.json.

I see that your dependency changes in the related PRs here, are adding changes to package-lock.json, but not to package.json, and I'm not sure I understand how that is supposed to work. i.e. if something is in package-lock.json, but it is not represented in package.json, that should remove the entries in package-lock.json when we run npm install? Or, are those sub-dependencies from something that is described in package.json?

@AlexanderKanakis
Copy link
Collaborator

AlexanderKanakis commented Feb 11, 2022

Oops, I did not specify. They are dependencies that come from @rocket.chat/apps-engine.

@ear-dev
Copy link
Author

ear-dev commented Feb 11, 2022

Still having a hard time getting this to work.... ever see this error?

image

@ear-dev
Copy link
Author

ear-dev commented Feb 11, 2022

Error occurred while sending a HTTP Request: { roomID: shYxGmd9cNkwAyb4o } {"stack":"TypeError: $s is not a constructor\n at It.detectStreamingIntent (evalmachine.<anonymous>:8:1361)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\n at It.sendRequest (evalmachine.<anonymous>:1:23383)\n at yo.run (evalmachine.<anonymous>:8:23852)\n at $o.executePostMessageSent (evalmachine.<anonymous>:8:29048)","message":"$s is not a constructor"}

@ear-dev
Copy link
Author

ear-dev commented Feb 11, 2022

@Shailesh351 can you review these three PRs please and test it out when you have a chance? FYI - we have a test CX bot that includes a test for partial responses.... I'm working on providing you all the config.json that will point to that test agent.

@ear-dev
Copy link
Author

ear-dev commented Mar 1, 2022

@AlexanderKanakis @Shailesh351 it sounds like we need to adjust the current blackout window for partial responses. 'if partial_respnse: wait for last response'

@ear-dev ear-dev changed the title [Brazil] integrate with Dialogflow CX's 'partial response' fuctionality [Brazil][BLOCKED on 1110] integrate with Dialogflow CX's 'partial response' fuctionality Mar 8, 2022
@ear-dev ear-dev changed the title [Brazil][BLOCKED on 1110] integrate with Dialogflow CX's 'partial response' fuctionality [Brazil] integrate with Dialogflow CX's 'partial response' fuctionality Mar 17, 2022
@ear-dev
Copy link
Author

ear-dev commented Mar 24, 2022

NOTE: blackout_window in effect until the final response from CX. queue_window still applies as designed for events.

blackout_window == drop all visitor messages
queue_window == send only the last visitor message if there is a queue

please document which payloads can be processed by rocketchat during the middle of a series of partial responses. MOTIVATION: we want to protect against CX developer user error.

@AlexanderKanakis
Copy link
Collaborator

AlexanderKanakis commented Mar 24, 2022

Custom Payloads:

Partial responses will not be able to handle payloads that require sending additional requests to the DF agent for any non-FINAL responses (the final message of a stream).

Currently supported Custom Payloads:

  1. df_set_timeout
  2. change_language_code
  3. drop_queue

@ear-dev
Copy link
Author

ear-dev commented Mar 24, 2022

@Shailesh351 @AlexanderKanakis I tested this out against our testbot test case and it worked well! Nice! @Shailesh351 can you please have a look at all three relevant PRs in this issue and review/approve when you have some time? Thanks! This will ultimately replace our use of 0 second timers.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants