Skip to content
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

Refactoring v3 mvp #1391

Draft
wants to merge 137 commits into
base: browser-version
Choose a base branch
from
Draft

Refactoring v3 mvp #1391

wants to merge 137 commits into from

Conversation

lss233
Copy link
Owner

@lss233 lss233 commented Feb 4, 2025

No description provided.

lss233 and others added 30 commits May 16, 2023 12:01
Co-authored-by: Sourcery AI <>
Co-authored-by: Sourcery AI <>
lss233 and others added 30 commits February 2, 2025 02:46
- Implemented HttpLegacyAdapter with Quart for HTTP-based message processing
- Added support for text, voice, and image message types
- Created HttpLegacyConfig for configurable server settings
- Integrated with WorkflowDispatcher for message routing
- Added comprehensive test suite for adapter functionality
- Updated requirements.txt to include Quart and Hypercorn
- Improved signal handling and server lifecycle management
- Added v2/chat endpoint with session-based request handling
- Implemented request tracking and response retrieval mechanism
- Added periodic cleanup for expired requests
- Improved message element handling and type safety
- Enhanced logging and configuration for the HTTP Legacy Adapter
- Introduced EditStateAdapter protocol for managing chat editing states
- Added ToggleEditState block in DefaultWorkflow to control editing indicators
- Implemented set_chat_editing_state method in TelegramAdapter
- Added telegramify-markdown to requirements for improved message formatting
- Enhanced message sending with Markdown V2 parsing
- Implemented get_adapter method to retrieve a specific IM adapter by key
- Provides a convenient way to access individual adapters from the IMManager
- Updated WorkflowDispatcher and WorkflowExecutor to support asynchronous workflow running
- Modified run() method to be async and use asyncio for concurrent block execution
- Integrated ThreadPoolExecutor with asyncio event loop for non-blocking workflow processing
- Added functools.partial for handling block execution with dynamic inputs
- Replaced get_logger with get_async_logger in HTTP Legacy Adapter
- Aligned logging import with recent async logging implementation
…l flow

This commit introduces significant improvements to the workflow execution framework:

- Added WorkflowBuilder DSL for more intuitive workflow construction
- Implemented control blocks for conditional and loop execution
- Refactored workflow execution to support complex flow control
- Moved default workflow to new location with builder-based creation
- Simplified workflow factory and removed redundant code
- Enhanced execution graph handling for parallel and conditional workflows
- Introduced MemoryAdapter for storing and retrieving conversation history
- Added QueryChatMemory and StoreMemory blocks to support context-aware interactions
- Enhanced default workflow to incorporate memory retrieval and storage
- Updated LLMChatMessage to use Literal type for role validation
- Created new IM message and state blocks in separate modules
- Improved workflow builder with more flexible node configuration
- Implemented save_to_yaml() method in WorkflowBuilder to serialize workflows
- Added load_from_yaml() class method to reconstruct workflows from YAML files
- Enhanced workflow builder with more robust node and connection handling
- Created comprehensive test suite for workflow serialization
- Added pytest.ini for improved async testing configuration
- Simplified block initialization and connection logic
- Introduced BlockRegistry to manage and track workflow blocks
- Created system_blocks.py to centralize system block registration
- Updated main.py to register system blocks during initialization
- Enhanced WorkflowBuilder to use block registry for YAML serialization
- Added support for block type resolution and warning for unregistered blocks
- Implemented comprehensive test cases for block registration and serialization
…kflows and rules

- Added WorkflowRegistry to manage workflow registration and loading
- Created DispatchRuleRegistry to handle dynamic dispatch rule management
- Implemented system workflows for games, chat, and system commands
- Added dispatch rules for various interaction types (prefix, keyword, regex)
- Created new workflow factories for game and system workflows
- Introduced new blocks for dice rolling, gacha simulation, and help generation
- Enhanced main.py with container initialization and workflow/rule loading
- Restructured workflow-related modules into a more organized hierarchy
- Moved workflow components into core, implementations, and specific submodules
- Updated import paths across the project to reflect new module structure
- Removed deprecated workflow_executor directory
- Consolidated workflow-related classes and functions
- Updated test cases and plugin adapters to use new import paths
- Removed verbose debug logging in WorkflowExecutor to improve performance
- Updated DefaultWorkflowFactory to create default workflow with enhanced system prompt
- Modified system workflows to use new create_default_workflow method
- Removed deprecated default workflow module
- Added current datetime to system prompt in default workflow
- Updated Gemini adapter to use debug logging for request contents
- Refactored rule creation logic in DispatchRuleRegistry to use a constructor mapping
- Added support for optional description field in dispatch rules
- Simplified rule validation and instantiation process
- Improved error handling for rule type and parameter validation
- Centralized rule constructor and parameter type checking
- Split memory module into separate submodules (scopes, composes, persistences)
- Extracted base classes and implementations into dedicated files
- Reorganized imports and improved code structure
- Added separate modules for memory entry, scopes, composers, and persistence strategies
- Simplified memory manager and persistence handling
- Updated tests to reflect new module structure
- Implemented ClearMemory block for clearing conversation memory
- Added `/清空记忆` dispatch rule to trigger memory clearing
- Updated MemoryManager with clear_memory method
- Enhanced DefaultMemoryDecomposer to handle empty memory entries
- Modified ChatResponseConverter to support multi-message responses using `<break>`
- Updated system prompt with more detailed character background
- Improved Telegram adapter with typing actions and simulated message delays
- Added WorkflowExecutor variable storage with set_variable and get_variable methods
- Implemented variable substitution in ChatMessageConstructor using regex
- Created SetVariableBlock and GetVariableBlock for workflow-level variable manipulation
- Updated create-workflow rule description to be more concise
- Enabled dynamic variable replacement in system and user prompts
- Introduced UserProfile data model with comprehensive user information
- Created UserProfileAdapter protocol for querying user profiles
- Implemented QueryUserProfileBlock for workflow-based user profile retrieval
- Added user profile query method to Telegram adapter with caching
- Supported flexible profile information extraction with fallback mechanisms
* feat: add new message elements to IM framework

- Introduced AtElement for mentioning users
- Added ReplyElement to support message replies
- Implemented FileElement for file message handling
- Created JsonElement for JSON-based messages
- Added FaceElement for emoji/sticker support
- Included VideoElement for video message transmission

* refactor: update FileElement to inherit from MediaMessage

- Modified FileElement to inherit from MediaMessage
- Enhanced to_dict method with more comprehensive media information
- Updated to_plain method to handle different file identification scenarios
- Added support for URL, path, data, and format attributes
- Added `empty_message` property to `MemoryDecomposer` base class
- Updated `DefaultMemoryDecomposer` to use `empty_message` for empty entries
- Modified test cases to use display names and message content in assertions
- Removed unnecessary test constant for invalid path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants