mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2026-05-12 21:08:11 +08:00
Introduce new modules including EngineApiDelegates, EngineBridgeDelegates, EngineRegistryBridgeFacade, EngineRuntimeBridgeFacade, EngineStageBridgeFacade, and EngineStageOrchestrator. These additions provide a structured approach to managing TTS requests, engine states, and orchestration, significantly improving the architecture and maintainability of the TTS system. The new components support asynchronous operations and enhance overall performance through better request handling and processing capabilities.
47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any, Dict
|
|
|
|
from GPT_SoVITS.TTS_infer_pack.unified_engine_runtime import EngineRuntimeFacade
|
|
|
|
|
|
class EngineRuntimeDelegates:
|
|
@staticmethod
|
|
def _safe_component_snapshot(component: Any) -> Dict[str, Any] | None:
|
|
return EngineRuntimeFacade._safe_component_snapshot(component)
|
|
|
|
def _build_stage_counters(
|
|
self,
|
|
request_registry: Dict[str, Any],
|
|
worker_state: Dict[str, Any],
|
|
) -> Dict[str, Any]:
|
|
return self.runtime_facade._build_stage_counters(request_registry, worker_state)
|
|
|
|
def _build_engine_policy_snapshot(
|
|
self,
|
|
request_registry: Dict[str, Any],
|
|
worker_state: Dict[str, Any],
|
|
) -> Dict[str, Any]:
|
|
return self.runtime_facade._build_engine_policy_snapshot(request_registry, worker_state)
|
|
|
|
async def _wait_for_engine_policy_admission(
|
|
self,
|
|
*,
|
|
request_id: str | None,
|
|
timeout_sec: float | None,
|
|
) -> tuple[float, Dict[str, Any]]:
|
|
return await self.engine_policy_arbiter.wait_for_policy_admission(
|
|
request_id=request_id,
|
|
timeout_sec=timeout_sec,
|
|
)
|
|
|
|
def _build_stage_summary(
|
|
self,
|
|
request_registry: Dict[str, Any],
|
|
worker_state: Dict[str, Any],
|
|
) -> Dict[str, Any]:
|
|
return self.runtime_facade._build_stage_summary(request_registry, worker_state)
|
|
|
|
def _wait_for_safe_reload(self, timeout_sec: float = 300.0) -> None:
|
|
self.runtime_facade._wait_for_safe_reload(timeout_sec=timeout_sec)
|