memoryscope.core.operation.backend_operation

class memoryscope.core.operation.backend_operation.BackendOperation(interval_time: int, **kwargs)[源代码]

基类:FrontendOperation

BaseBackendOperation serves as an abstract base class for defining backend operations. It manages operation status, loop control, and integrates with a global context for thread management.

operation_type: Literal['frontend', 'backend'] = 'backend'
__init__(interval_time: int, **kwargs)[源代码]

Initializes a new instance of the BaseOperation.

init_workflow(**kwargs)[源代码]

Initializes the workflow by setting up workers with provided keyword arguments.

参数:

**kwargs -- Arbitrary keyword arguments to be passed during worker initialization.

start_operation_backend(**kwargs)[源代码]

Initiates the background operation loop if it's not already running. Sets the _loop_switch to True and submits the _loop_operation to a thread from the global thread pool.

stop_operation_backend(wait_operation: bool = False)[源代码]

Stops the background operation loop by setting the _loop_switch to False.

name: str
memoryscope_context: MemoryscopeContext
thread_pool: ThreadPoolExecutor
workflow: str
workflow_worker_list: List[List[List[str]]]
worker_dict: Dict[str, BaseWorker | bool]
workflow_context: Dict[str, Any]
logger: Logger
user_name: str
target_names: List[str]
chat_messages: List[List[Message]]
description: str