bedelightful / be-delightful-module
Be Delightful Module for Hyperf Framework
Installs: 14
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
pkg:composer/bedelightful/be-delightful-module
Requires
- 96qbhy/hyperf-auth: ^3.1
- bedelightful/api-response: ~0.1
- hyperf/amqp: ^3.1
- hyperf/cache: ^3.1
- hyperf/constants: ~3.1
- hyperf/crontab: ~3.1.0
- hyperf/database: ~3.1.0
- hyperf/db-connection: ~3.1.0
- hyperf/engine-swow: ^2.12
- hyperf/guzzle: ~3.1.0
- hyperf/http-message: ~3.1.0
- hyperf/http-server: ~3.1.0
- hyperf/logger: ~3.1.0
- hyperf/phar: ~3.1.0
- hyperf/process: ~3.1.0
- hyperf/rate-limit: ^3.1
- hyperf/redis: ~3.1.0
- hyperf/snowflake: ~3.1.0
- hyperf/socketio-server: ^3.1
- hyperf/translation: ~3.1.0
- hyperf/validation: ^3.1
- hyperf/websocket-client: ^3.1
- hyperf/websocket-server: ~3.1.0
- overtrue/chinese-calendar: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- hyperf/devtool: ~3.1.0
- hyperf/testing: ~3.1.0
- mockery/mockery: ^1.0
- phpstan/phpstan: ^1.0
- roave/security-advisories: dev-latest
README
Introduction
Be Delightful Module is an extension package based on the Hyperf framework, designed as an enhanced extension module specifically for delightful-service. This module adopts Domain-Driven Design (DDD) architecture, providing a clear layered structure and rich functional components for applications.
Be Delightful Module needs to be used in conjunction with delightful-service. Its core functionality is to establish an information transmission channel between users and the Super Delightful AI agent by taking over delightful-service message events. This design enables users to seamlessly interact with the agent, thereby obtaining a more intelligent service experience.
As a bridging module, Be Delightful Module not only handles message delivery but also handles data format conversion, coordinates event flows, and provides necessary context information to ensure that the agent can accurately understand user intentions and provide appropriate responses.
Features
- Built on Hyperf 3.1, perfectly adapted to existing delightful-service architecture
- Follows Domain-Driven Design (DDD) architecture with clear code organization and easy maintenance
- Provides resource sharing functionality, supporting cross-module resource access
- Acts as a message channel, connecting users with the Super Delightful AI agent
- Supports event listening and handling, responding to user requests in real-time
- Provides workspace management, supporting multi-topic and multi-task processing
- Implements file management system, supporting agent file operations
- PSR-compliant code organization, ensuring code quality
System Architecture
Be Delightful Module, as an extension of delightful-service, plays the following role in the system:
User Request → delightful-service → Be Delightful Module → Super Delightful AI Agent
↑ |
└─────────────────┘
Response Return
This module integrates with delightful-service through the following methods:
- Listen to delightful-service message events
- Process and transform message formats
- Deliver messages to the Super Delightful AI agent
- Receive and process agent responses
- Return processing results to delightful-service
Installation
Install via Composer:
composer require dtyq/be-delightful-module
Basic Usage
Configuration
The module provides ConfigProvider for registering related services and features. Configure in the Hyperf application's config/autoload directory:
<?php return [ // Load ConfigProvider \Dtyq\BeDelightful\ConfigProvider::class, ];
Integration with delightful-service
To integrate Be Delightful Module with delightful-service, you need to override dependencies in delightful-service:
[
'dependencies_priority' => [
// Assistant execution event
AgentExecuteInterface::class => BeAgentMessageSubscriberV2::class,
BeAgentMessageInterface::class => BeAgentMessage::class,
]
]
Domain Layer Usage
The module is designed based on DDD architecture and includes the following main layers:
- Domain Layer: Contains business logic and entities, such as message processing, workspace management, and other core functions
- Application Layer: Coordinates domain objects to complete complex business scenarios, such as message delivery processes
- Infrastructure Layer: Provides technical support, including data storage, external service calls, etc.
- Interfaces Layer: Handles external requests and responses, providing API interfaces
Development
Directory Structure
src/
├── Application/ # Application layer, handles business processes
│ ├── Share/ # Resource sharing services
│ └── BeAgent/ # Super agent services
├── Domain/ # Domain layer, contains core business logic
│ ├── Share/ # Resource sharing domain models
│ └── BeAgent/ # Super agent domain models
├── Infrastructure/ # Infrastructure layer, provides technical implementation
│ ├── ExternalAPI/ # External API calls
│ └── Utils/ # Utility classes
├── Interfaces/ # Interface layer, handles external interactions
│ ├── Share/ # Resource sharing interfaces
│ └── BeAgent/ # Super agent interfaces
├── Listener/ # Event listeners
└── ConfigProvider.php # Configuration provider
Commands
This extension package provides a series of useful commands:
# Code style fix composer fix # Static code analysis composer analyse # Execute tests composer test # Start Hyperf service composer start
Message Flow
The basic flow for Be Delightful Module to process messages is as follows:
- User sends a message in delightful-service
- delightful-service triggers a message event
- Be Delightful Module listens to the event and extracts message content
- Message is converted to a format understandable by the Super Delightful AI agent
- Message is sent to the Super Delightful AI agent
- Agent processes the message and generates a response
- Be Delightful Module receives the response and converts the format
- Response is passed back to delightful-service through events
- User receives the agent's response
Testing
Execute tests:
composer test
Contribution Guidelines
- Fork this repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Create a Pull Request
Related Resources
- Hyperf Official Documentation
- PSR Standards
- Domain-Driven Design Reference
- Delightful Service Documentation
Authors
- dtyq team - team@dtyq.com
License
This project uses a private license - please refer to the internal team documentation for details.
Project Status
This module is under active development. As an enhancement component of delightful-service, it continuously provides upgrades to intelligent interaction capabilities. We welcome feedback and suggestions from team members to jointly improve this key module.