feat(wecom_bot): support persistent and pass conversation_id#2828
feat(wecom_bot): support persistent and pass conversation_id#2828leslie2046 wants to merge 1 commit intolanggenius:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces multi-turn conversation support for the WeCom bot by implementing session-based storage for conversation IDs. It also updates the dify_plugin dependency to version 0.7.1 and bumps the project version to 0.0.3. Feedback was provided regarding the use of a broad exception handler when retrieving the application ID, suggesting a more explicit type check for better clarity and error handling.
| try: | ||
| app = settings.get("app") | ||
| app_id = app.get("app_id") if app else "" | ||
| except Exception: | ||
| app_id = "" |
There was a problem hiding this comment.
Using a broad try...except Exception can hide unexpected errors and makes the code harder to understand. It's better to handle expected cases explicitly for improved clarity and robustness. You can safely retrieve app_id by checking if app is a dictionary instance.
app = settings.get("app")
app_id = (app.get("app_id") or "") if isinstance(app, dict) else ""
Related Issues or Context
Supports persistent and pass conversation_id
App ID and user ID can be used together as the key
This PR contains Changes to Non-Plugin
This PR contains Changes to Non-LLM Models Plugin
This PR contains Changes to LLM Models Plugin
Version Control (Any Changes to the Plugin Will Require Bumping the Version)
VersionField, Not in Meta Section)Dify Plugin SDK Version
dify_plugin>=0.3.0,<0.6.0is in requirements.txt (SDK docs)Environment Verification (If Any Code Changes)
Local Deployment Environment
SaaS Environment