mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-19 00:01:33 +00:00
- Add BaseClient, BaseFileStore, BaseFileWatcher, BaseJob, BaseService, and BaseStep classes - Move component initialization logic from ApplicationContext to Application class - Add logo printing and logging initialization in Application startup - Create client module with base client implementation - Add file store base class with embedding resolution and validation - Implement file watcher base class with watchfiles integration - Add job base class for sequential step execution orchestration - Create service base class for job exposure mechanisms - Refactor BaseStep with LLM workflow execution capabilities - Add case converter utility for naming convention transformations - Update import structure and module organization - Add proper type hints and docstrings across all components - Implement component registry integration for dynamic loading - Add error handling for missing backend configurations
33 lines
1.3 KiB
Python
33 lines
1.3 KiB
Python
"""Application context for initializing and managing all configured components."""
|
|
|
|
from ..enumeration import ComponentEnum
|
|
from ..schema import ApplicationConfig
|
|
|
|
|
|
class ApplicationContext:
|
|
"""Application context that initializes and manages all configured components.
|
|
|
|
This class is responsible for parsing the application configuration,
|
|
resolving backend implementations for each component via the registry,
|
|
and instantiating services, components, and jobs.
|
|
"""
|
|
|
|
def __init__(self, **kwargs):
|
|
"""Initialize the application context from configuration kwargs.
|
|
|
|
Args:
|
|
**kwargs: Keyword arguments that form the ApplicationConfig,
|
|
including app_name, service, components, and jobs.
|
|
|
|
Raises:
|
|
ValueError: If a required backend is missing for the service, any component, or any job,
|
|
or if a service, component, or job references an unregistered backend type.
|
|
"""
|
|
self.app_config: ApplicationConfig = ApplicationConfig(**kwargs)
|
|
|
|
from .base_component import BaseComponent
|
|
from .job.base_job import BaseJob
|
|
|
|
self.service = None
|
|
self.components: dict[ComponentEnum, dict[str, BaseComponent]] = {}
|
|
self.jobs: dict[str, BaseJob] = {}
|