-
Notifications
You must be signed in to change notification settings - Fork 79
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
singletone action upload in appendmode fix #1609
singletone action upload in appendmode fix #1609
Conversation
WalkthroughThe changes involve modifications to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ActionSerializer
participant Database
User->>ActionSerializer: Call deserialize(bot, user, actions, overwrite=False)
ActionSerializer->>Database: Check for existing action
alt Action exists
ActionSerializer-->>User: Raise AppException (duplicate action)
else Action does not exist
ActionSerializer->>Database: Add new action
ActionSerializer-->>User: Confirm action added
end
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
kairon/shared/data/action_serializer.py (1)
341-344
: LGTM! Consider adding documentation.The logic correctly prevents duplicate single instance actions in append mode. This fixes the singleton action upload issue.
Consider adding a comment to explain the single instance behavior:
if action_info.get('single_instance'): if overwrite: filtered_actions[action_type] = actions[action_type] else: + # Skip adding new actions if a single instance action already exists existing_action = action_info.get("db_model").objects(bot=bot).first() if not existing_action: filtered_actions[action_type] = actions[action_type]
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
tests/unit_test/data_processor/action_serializer_test.py (2)
610-610
: Remove debug print statementThe
print(action_names)
statement appears to be a debugging artifact and should be removed.- print(action_names)
612-613
: Optimize variable usageThe
names
variable is redundant asaction_names
already contains the same data. Consider usingaction_names
directly.- names = [action.name for action in actions_added] - assert "live_agent_action" in names + assert "live_agent_action" in action_names
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
tests/unit_test/data_processor/action_serializer_test.py
(2 hunks)
🔇 Additional comments (2)
tests/unit_test/data_processor/action_serializer_test.py (2)
6-6
: LGTM!
The import of LiveAgentActionConfig
is correctly added to support the new test cases.
591-623
: LGTM! Well-structured test cases
The test function effectively verifies the single instance behavior of live agent actions:
- Successfully adds a new live agent action when it doesn't exist
- Correctly handles duplicate attempts by maintaining only one instance
Summary by CodeRabbit
New Features
Bug Fixes
Tests