Problem/Motivation
When working with contexts and Dialogflow I came across some issues with getIntentAttribute and setIntentAttribute as follows:
- getIntentAttribute assumes the context is keyed by name, it isn't
- setIntentAttribute doesn't work if you need to set an array of values - e.g you might need to set some-context.param1 and some-context.param2 - the current code sets them as two separate contexts, one of which is dropped by the Dialogflow API
For my immediate needs I ended up working directly with the original request object, but will circle back for a permanent fix.
Proposed resolution
Failing tests
Fixes
Remaining tasks
The lot
User interface changes
None
API changes
None
Data model changes
(Database or configuration data changes that would make stored data on an existing site incompatible with the site's updated codebase, including changes to hook_schema(), configuration schema or keys, or the expected format of stored data, etc.)
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2919609-11.patch | 6.84 KB | gambry |
| #11 | interdiff-9-11.txt | 761 bytes | gambry |
Comments
Comment #2
gambryMoving this to Chatbot API as the problem is on the chatbot_api_apiai driver's proxy classes.
I had a quick look and I can see there is no way to set 2 context parameters.
That should be possible. By looking at the code, the second call should override the first one (so param1 is lost). But as I said I haven't tried myself.
We'll have a look ASAP, trying to provide a failing test first.
Comment #3
larowlanI will aim to work on this next week at the sprint
Comment #4
gambryFailing test and approach to fix
IntentRequestApiAiProxyattached.I think fixing IntentResponseApiAiProxy will require some re-factoring of the
iboldurev/api-ai-phpmodels. We currently hosts Webhook modules in Dialogflow Webhook contrib, but our models have been pushed in latest version ofiboldurev/api-ai-phpso we need to make sure if we do any refactoring we PR the changes there too.Setting Needs Review for letting the testbot test the patches, issue currently still needs work.
Comment #7
larowlancould we break/return early when we get a match?
Thanks for picking this up, forgot all about it
Comment #8
gambryTests against patch fail ontestSetIntentAttribute()too. This is not expected - and it didn't happen locally yesterday -.I will have a look later.
Yes of course, staying in the loop doesn't make sense if there is a match.
No problem at all! I had a bit of time for contributing this weekend.
This is currently the only blocker for a stable release.
Comment #9
gambryPatch implements early return on context getter as per #7 and fix setter, including additional testing coverage.
Comment #10
larowlanWill we ever have $value now?
Other than that, rtbc in my book
Comment #11
gambry$valueis always$default, so we can directly return the latter.RTBCing as per #10 to trigger the tests. If green I will commit.
Thanks @larowlan for your reviews!
Comment #13
gambryCommitted and pushed. I'm going to review if this is really the only blocker, if it is will release a RC.
Thanks.
Comment #14
larowlancongratulations!