Closed hasinaxp closed 1 week ago
The changes introduced in this pull request enhance the message dispatching logic in the async_callback
and callback_function
methods, ensuring that messages are only sent when valid responses are available. Additionally, new functionality is added for handling live agent actions, including methods for listing and loading these actions. The test suite is updated to reflect the inclusion of live agent actions in expected outputs and configurations, indicating an expansion in action handling capabilities.
Files | Change Summary |
---|---|
kairon/async_callback/processor.py |
Improved conditional logic for dispatching messages in async_callback and callback_function methods to ensure valid responses are sent. |
kairon/shared/data/processor.py |
Added list_live_agent_actions method for fetching live agent actions and updated save_integrated_actions and load_action_configurations to integrate live agent actions. |
tests/unit_test/data_processor/data_processor_test.py |
Updated tests to include live_agent_action in expected outputs and configurations, reflecting the new action handling capabilities. |
edit_live_agent
function in this PR may connect with the changes in the main PR, as both involve handling live agent actions and their configurations.🐇 In the meadow, where bunnies play,
New actions bloom, brightening the day.
With messages sent, responses so true,
Live agents now dance, in fields of blue.
Hopping with joy, we celebrate the change,
For in our code, the magic's rearranged! 🌼✨
kairon/async_callback/processor.py (2)
`85-86`: **LGTM!** The added `if` statement enhances the robustness of the message dispatching process by ensuring that messages are only dispatched when there is a valid `bot_response`. This change aligns with the PR objective of improving error handling and potentially reduces errors caused by attempting to send null or empty responses. --- `155-156`: **Looks good!** The added `if` statement enhances the robustness of the message dispatching process by ensuring that messages are only dispatched when there is valid `data` to send. This change aligns with the PR objective of improving error handling and potentially reduces errors caused by attempting to send null or empty data.kairon/shared/data/processor.py (4)
`4171-4188`: **LGTM!** The `list_live_agent_actions` method looks good. It correctly fetches the live agent action configurations from the database, processes them, and yields the relevant fields based on the `with_doc_id` parameter. --- `4930-4937`: **Looks good!** The `load_live_agent_action` method is implemented correctly. It fetches the live agent actions using the `list_live_agent_actions` method and returns them in the expected format. --- Line range hint `4716-4726`: **Validation logic looks correct!** The `__validate_payload` method properly validates the payload for database actions. It checks if the specified slots exist in the bot's configuration when the item type is `from_slot`. If a slot doesn't exist, it raises an appropriate exception. --- Line range hint `4758-4765`: **Database action loading looks good!** The `load_database_action` method is implemented correctly. It fetches the database actions using the `list_db_actions` method and returns them in the expected format.tests/unit_test/data_processor/data_processor_test.py (2)
`3568-3568`: **LGTM!** The addition of `live_agent_action` to the `expected_actions` string is consistent with the PR objectives and indicates an enhancement in the action handling capabilities of the data processor. --- `3605-3605`: **LGTM!** The addition of `'live_agent_action': []` to the `action_config` dictionary is consistent with the PR objectives and indicates an enhancement in the action handling capabilities of the data processor.
optional bot_response in callback action (log failure for no bot_response fix) added live agent in upload download
Summary by CodeRabbit
New Features
Bug Fixes
Tests
live_agent_action
in expected outputs and configurations, reflecting new action handling capabilities.