main
py 31 lines 1006 Bytes
Raw
1 import importlib.metadata
2
3 from helpers.api import ApiHandler, Request, Response
4 from plugins._whisper_stt.helpers import migration, runtime
5
6
7 class Status(ApiHandler):
8 async def process(self, input: dict, request: Request) -> dict | Response:
9 migration.ensure_config_seeded()
10
11 package_version = ""
12 package_error = ""
13 try:
14 package_version = importlib.metadata.version("openai-whisper")
15 except Exception as e:
16 package_error = str(e)
17
18 return {
19 "plugin": "_whisper_stt",
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 "loaded_model": runtime.get_loaded_model_name(),
26 },
27 "package": {
28 "version": package_version,
29 "error": package_error,
30 },
31 }