-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Treat list custom json facebook #9567
Treat list custom json facebook #9567
Conversation
Co-authored-by: David <[email protected]>
* Add ability to point to a certificate in endpoints.yml (RasaHQ#9118) * Add cert file functionality to Endpoint * Apply suggestions from code review types Co-authored-by: Tobias Wochinger <[email protected]> * update changelog Co-authored-by: Tobias Wochinger <[email protected]> * Fix epoch override for TEDPolicy (RasaHQ#9182) * bump rasa-sdk dep and min compat version * fix bug add tests * add changelog * change test cases * remove test cases * prepared release of version 2.8.1 (RasaHQ#9183) * update rasa-sdk * prepared release of version 2.8.1 * update lock * Make UnexpecTEDIntentPolicy compatible with E2E data (RasaHQ#9203) * bump rasa-sdk dep and min compat version * add test and code * add changelog and refactor method * add test * more test cases * use applied_events * 2.8.x: Remove experimental feature warning for story validation and entity roles and groups (RasaHQ#9237) * I removed the experimental feature designation from the docs. * I removed the entity roles and groups experimental feature warning message from the code, and tested it using 'rasa train' on a minimal example. * I removed the unused import: rasa.shared.utils.common * Adding change log files for issues 8791 and 8024. * Rewording change logs to make it clear that the behaviour of the features remains unchanged. * prepared release of version 2.8.2 (RasaHQ#9262) * prepared release of version 2.8.2 * Updated the date of release. * install yarn dependency in cloned repository, in docs publication workflow * silence yarn warning * Fix typo in push_docs_to_branch.sh * Generated a new poetry lock file Co-authored-by: Joe Juzl <[email protected]> Co-authored-by: Tobias Wochinger <[email protected]> Co-authored-by: Daksh Varshneya <[email protected]> Co-authored-by: m-vdb <[email protected]>
Co-authored-by: David <[email protected]>
…wavymazy/rasa into treat-list-custom-json-facebook
I just realised I accidentally pushed some files from another issue I was working on, sorry! |
Ok, ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for continuing work on this issue 💯
In addition to the suggestions below, I'd like to request you to rebase to target 2.8.x
since this is actually a bugfix and this could be released in a minor.
Probably the easiest would be to open a new PR with only the solution specific to this bugfix (and not the README diff that shouldn't be in this PR) to avoid potential git funkiness when rebasing. If you choose this route, you can close this PR afterwards.
@@ -0,0 +1 @@ | |||
Add list handling in the `send_custom_json` method on `channels/facebook.py`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this changelog entry should actually be a bugfix
rather than improvement
based on the original issue. It would also be great if you could give more details around the bug since it isn't very clear for me in which circumstances would the json_message
be of type list
rather than dict
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Done in a new branch rebase-treat-custom-json-fb
.
I haven't pushed it yet, but soon I will and I'll also open the new PR.
) -> None: | ||
"""Sends custom json data to the output.""" | ||
|
||
recipient_id = json_message.pop("sender", {}).pop("id", None) or recipient_id | ||
if isinstance(json_message, dict) and "sender" in json_message.keys(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs a check if json_message
is list
and assigning recipient_id
to the extracted id
from json_message
.
Potentially also json_message
needs to be updated to be of dict
type when being given as an argument to self.messenger_client.send()
, not entirely sure since Facebook code doesn't have type annotations.
I'd advise researching a bit how to test that this works with MessengerClient
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, except the part regarding json_message
being updated to dict
.
It seams to be ok passing a list
to self.messenger_client.send()
.
@@ -0,0 +1,91 @@ | |||
import logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please shift this file into the correct subdirectory: tests/core/channels
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
}, | ||
] | ||
} | ||
json_with_id = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should also check that send_custom_json
works with json_message
as list
.
I would also suggest using pytest.mark.parametrize
for different json
inputs and expected
values of recipient_id
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@ancalita ok, I'm on it ! |
Co-authored-by: Anca Lita <[email protected]>
Closing this PR. The new one is #9692, rebased to 2.8.x. |
Hello, I am continuing the work that was previously being done here -> #8332.
It solves #5657
Proposed changes:
json_message
atsend_custom_json
, as suggested here Treat list custom json facebook #8332Status (please check what you already did):
black
(please check Readme for instructions)