mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-19 00:01:33 +00:00
- Replace ReMeClient with modular client implementations - Add component registry with type-based registration system - Introduce BaseClient extending BaseComponent with lifecycle management - Create HttpClient with environment-based service discovery - Add constants for default host/port configurations - Update service info propagation through environment variables - Restructure imports and exports across component modules - Add run_coro_safely utility for safe coroutine execution - Implement component type enumeration for better organization - Register components with R decorator for automatic discovery - Add placeholder methods for ReMe core functionalities - Update command-line entry point to use dynamic client selection
25 lines
736 B
Python
25 lines
736 B
Python
"""Abstract base class for client implementations."""
|
|
|
|
from abc import abstractmethod
|
|
|
|
from ..base_component import BaseComponent
|
|
from ...enumeration import ComponentEnum
|
|
|
|
|
|
class BaseClient(BaseComponent):
|
|
"""Abstract base class for clients that communicate with ReMe services."""
|
|
component_type = ComponentEnum.CLIENT
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
super().__init__(**kwargs)
|
|
self.client = None
|
|
|
|
async def _start(self, app_context=None) -> None:
|
|
"""Initialize the client."""
|
|
|
|
async def _close(self) -> None:
|
|
"""Close the client."""
|
|
|
|
@abstractmethod
|
|
async def __call__(self, action: str, **kwargs) -> dict:
|
|
"""Invoke an action with the given configuration."""
|