mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 09:28:56 +00:00
Offer Paradee Heart alongside Kokoro voices in the existing bundled TTS plugin. Default unconfigured settings to Paradee while preserving saved Kokoro voices, blends, speed and activation choices. Switching engines replaces the voice selection without a separate plugin or startup dialog. Add lazy CPU ONNX synthesis with cached, pinned model assets and split long input without dropping phonemes. Make status and preload follow the selected engine, and present both engines through the Local TTS UI. Prepare Paradee dependencies in hooks.py on plugin install/update, enabled-plugin startup and re-enable. Reuse installed packages, preserve browser fallback on setup failure and keep requirements.txt unchanged. Update plugin documentation and regression coverage. Validation: 44 focused tests passed in both host and Docker framework runtimes. Live synthesis and voice-picker switching passed on localhost:32081. git diff --check passed. Fresh-image builds and actual missing-package installation were not tested.
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
import importlib.metadata
|
|
|
|
from helpers.api import ApiHandler, Request, Response
|
|
from plugins._kokoro_tts.helpers import migration, runtime
|
|
|
|
|
|
class Status(ApiHandler):
|
|
async def process(self, input: dict, request: Request) -> dict | Response:
|
|
migration.ensure_migrated()
|
|
config = runtime.get_config()
|
|
engine = "paradee" if config["voice"] == "paradee" else "kokoro"
|
|
package_name = "onnxruntime" if engine == "paradee" else "kokoro"
|
|
|
|
package_version = ""
|
|
package_error = ""
|
|
try:
|
|
package_version = importlib.metadata.version(package_name)
|
|
except Exception as e:
|
|
package_error = str(e)
|
|
|
|
return {
|
|
"plugin": "_kokoro_tts",
|
|
"enabled": runtime.is_globally_enabled(),
|
|
"config": config,
|
|
"engine": engine,
|
|
"model": {
|
|
"ready": await runtime.is_downloaded(config),
|
|
"loading": await runtime.is_downloading(config),
|
|
},
|
|
"package": {
|
|
"name": package_name,
|
|
"version": package_version,
|
|
"error": package_error,
|
|
},
|
|
"fallback": "Browser-native speechSynthesis remains the fallback when local TTS is disabled.",
|
|
}
|