-
Notifications
You must be signed in to change notification settings - Fork 35
feat(backend): add direct chat support for Chat and Dify shell types #248
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
base: main
Are you sure you want to change the base?
Conversation
- Add baseImage and baseShellRef fields to ShellSpec schema - Update public shells init data with default baseImage - Create Shell unified API endpoints (/shells/unified, CRUD operations) - Add image validation API to check compatibility with shell types - Modify task dispatch to pass baseImage to Executor Manager - Add executor binary extraction on Executor Manager startup - Support Base Image + Executor mount mode in Docker executor - Create frontend Shell API client and management UI components - Add Shells tab to Settings page with i18n support The feature enables users to create custom shells with their own base images while using the latest executor binary via Named Volume mount.
- Fix ShellList Tag variant error (use 'default' instead of 'outline') - Move image validation logic to Executor Manager API (/executor-manager/images/validate) - Backend shells API now proxies validation requests to Executor Manager - Support various deployment modes (Docker, K8s) where backend may not have direct Docker access
- Create ImageValidatorAgent for running validation inside container - Modify executor_manager to dispatch validation tasks via task processor - Update backend shells API for async validation response - Update frontend to handle async validation status - Add i18n translations for validation status messages This approach uses the actual executor run flow instead of direct docker subprocess calls, making it extensible for both Docker and K8s modes. Validation runs inside the target container and reports results via callback.
…ling
- Add UUID-based validation tracking with Redis storage (5min TTL)
- Add validation status query endpoint GET /api/shells/validation-status/{id}
- Add validation status update endpoint for internal callback forwarding
- Enhance Executor Manager to pass validation_id and forward callbacks to Backend
- Enhance Docker executor to report container start/pull failures
- Add stage progress reporting in ImageValidatorAgent (submitted/pulling/starting/running_checks/completed)
- Implement frontend polling mechanism with 2s interval, 120s timeout
- Disable save button until validation passes (forced validation for new/changed baseImage)
- Add progress bar UI showing real-time validation stages
- Add i18n messages for validation stages in both en/zh-CN
…orting Add httpx>=0.24.0 to requirements.txt to fix CI test failure. The httpx library is required by docker executor to report validation stage progress to the backend API.
Fix ESLint errors for unused variables: - Rename validationId to _validationId (stored for future use) - Remove pollingCount state (internal count only needed in closure)
# Conflicts: # docs/en/reference/yaml-specification.md # docs/zh/reference/yaml-specification.md # frontend/src/i18n/locales/en/common.json # frontend/src/i18n/locales/zh-CN/common.json
Add new Chat Shell type and optimize Dify Shell to support direct API calls from Backend without requiring Docker Executor containers. This improves response speed for lightweight chat scenarios. Key changes: - Add new direct_chat service module with async streaming support - Add Chat public shell type supporting Claude and OpenAI compatible APIs - Add direct chat API endpoints for SSE streaming - Add MAX_CONCURRENT_DIRECT_CHATS config for concurrency control - Add helper function to check if team supports direct chat mode - Store chat history and Dify conversation IDs in Redis - Use shared HTTP client with connection pooling
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Key Changes
New Files
backend/app/services/direct_chat/- Direct chat service modulebase.py- Base class, shared HTTP client with connection poolingsession_manager.py- Redis session state managementchat_service.py- Chat service for Claude/OpenAI APIsdify_service.py- Dify service adapted from executor for asyncbackend/app/api/endpoints/adapter/direct_chat.py- SSE streaming endpointsModified Files
backend/app/core/config.py- Add MAX_CONCURRENT_DIRECT_CHATS configbackend/app/main.py- HTTP client lifecycle managementbackend/app/services/adapters/task_kinds.py- Add direct chat check helperbackend/init_data/02-public-shells.yaml- Add Chat public shell definitionbackend/app/api/api.py- Register direct chat routesTechnical Constraints Met
Test Plan