-
-
Notifications
You must be signed in to change notification settings - Fork 665
pull #3299
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
pull #3299
Conversation
- 代理修复: - 安装 http-proxy-agent 依赖。 - 使用 axios 替代内置 http 模块,并添加 User-Agent,解决了 socket hang up 的问题。 - 会话删除修复: - 将删除逻辑从 fs.rmSync 改为 fs-extra.remove,增强了可靠性。 - 调整了 removeSession 的操作顺序,先从内存中删除会话,再执行清理,彻底解决了因竞态条件导致的会话“复活”问题。 - 代码清理: - 移除了前端未使用的 SOCKS5 代理配置模态框及其相关JS代码。 - 流程改进: - 承诺在每次修改后运行 npm run build 进行构建验证。
Caution Review failedThe pull request is closed. WalkthroughThis update introduces a comprehensive multi-session architecture for managing multiple WhatsApp sessions within a single server instance. It adds a robust session manager, RESTful API, web management UI, extensive configuration and proxy support, Chatwoot integration, and a suite of supporting utilities, models, and documentation. The changes span backend logic, frontend assets, configuration, and developer tools. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant WebUI
participant MultiSessionAPI
participant SessionManager
participant WhatsAppClient
User->>WebUI: Open dashboard / create session
WebUI->>MultiSessionAPI: POST /api/v1/sessions (with config)
MultiSessionAPI->>SessionManager: createSession(sessionId, config, waitForQR)
SessionManager->>WhatsAppClient: Initialize client session
WhatsAppClient-->>SessionManager: Emits QR code event
SessionManager-->>MultiSessionAPI: Returns session status + QR code
MultiSessionAPI-->>WebUI: Session info + QR code (base64/image)
WebUI-->>User: Display QR code for scanning
User->>WebUI: Request session actions (restart, delete, edit proxy)
WebUI->>MultiSessionAPI: (PATCH/DELETE/PUT) /api/v1/sessions/:id
MultiSessionAPI->>SessionManager: Perform action (restart/remove/updateProxy)
SessionManager->>WhatsAppClient: Apply changes
SessionManager-->>MultiSessionAPI: Updated session status
MultiSessionAPI-->>WebUI: Updated session info
WebUI-->>User: Update UI
sequenceDiagram
participant WebUI
participant MultiSessionAPI
participant SessionManager
participant ChatwootIntegration
WebUI->>MultiSessionAPI: POST /api/v1/sessions/:id/chatwoot (setup)
MultiSessionAPI->>ChatwootIntegration: initSessionChatwoot(sessionId, config)
ChatwootIntegration-->>MultiSessionAPI: Status (webhook verified, etc.)
MultiSessionAPI-->>WebUI: Chatwoot setup result
WebUI->>MultiSessionAPI: POST /api/v1/sessions/:id/chatwoot/webhook
MultiSessionAPI->>SessionManager: getClient(sessionId)
SessionManager->>WhatsAppClient: handleChatwootWebhook(webhookData)
WhatsAppClient-->>SessionManager: Webhook processed
SessionManager-->>MultiSessionAPI: Result
MultiSessionAPI-->>WebUI: Webhook response
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm warn deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
📝 Documentation updates detected! New suggestion: Add comprehensive multi-session mode documentation |
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Style
Chores
Tests