main
py 31 lines 1.01 KB
Raw
1 import importlib.metadata
2
3 from helpers.api import ApiHandler, Request, Response
4 from plugins._kokoro_tts.helpers import migration, runtime
5
6
7 class Status(ApiHandler):
8 async def process(self, input: dict, request: Request) -> dict | Response:
9 migration.ensure_migrated()
10
11 package_version = ""
12 package_error = ""
13 try:
14 package_version = importlib.metadata.version("kokoro")
15 except Exception as e:
16 package_error = str(e)
17
18 return {
19 "plugin": "_kokoro_tts",
20 "enabled": runtime.is_globally_enabled(),
21 "config": runtime.get_config(),
22 "model": {
23 "ready": await runtime.is_downloaded(),
24 "loading": await runtime.is_downloading(),
25 },
26 "package": {
27 "version": package_version,
28 "error": package_error,
29 },
30 "fallback": "Browser-native speechSynthesis remains the fallback when Kokoro is disabled.",
31 }