From 29ace2ac85d338670dc6d0d48a3c471f114118a4 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 17 Apr 2026 15:22:20 +0800 Subject: [PATCH] bugfix --- app/aligner.py | 22 ++++++++++++++++++++-- conf/config.json | 4 ++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/aligner.py b/app/aligner.py index e6458f4..9365b0c 100644 --- a/app/aligner.py +++ b/app/aligner.py @@ -4,8 +4,25 @@ from ahserver.webapp import webapp from ahserver.filestorage import FileStorage from appPublic.worker import awaitify from appPublic.jsonConfig import getConfig +from appPublic.registerfunction import RegisterFunction -async def align(audio_webpath, text): +async def align(request, *params, params_kw={}): + audio_webpath = params_kw.audio_path + text = params_kw.text + if audio_webpath is None: + return { + "status": "error", + "data": { + "message": "audio_path is None" + } + } + if text is None: + return { + "status": "error", + "data": { + "message": "text is None" + } + } env = ServerEnv() fs = FileStorage() audio_path = fs.realPath(audio_webpath) @@ -30,10 +47,11 @@ async def align(audio_webpath, text): return sentences def init(): + rf = RegisterFunction() + rf.register('align', align) env = ServerEnv() config = getConfig() env.align_engine = AlignEngine(config.align_model) - env.align = align if __name_ == '__main__': webapp(init) diff --git a/conf/config.json b/conf/config.json index acbeec7..2841240 100644 --- a/conf/config.json +++ b/conf/config.json @@ -28,8 +28,8 @@ "leading":"/idfile", "registerfunction":"idfile" },{ - "leading":"/i18n_getmsgs", - "registerfunction":"i18n" + "leading":"/align", + "registerfunction":"align" } ] }