👍️[Update] Controller : AIモデルが使用可能かを通知するエンドポイントを追加

This commit is contained in:
misyaguziya
2025-02-08 14:29:02 +09:00
parent 07723d495a
commit 7746cffb08
2 changed files with 21 additions and 0 deletions

View File

@@ -39,6 +39,20 @@ class Controller:
False, False,
) )
def enableAiModels(self) -> None:
self.run(
200,
self.run_mapping["enable_ai_models"],
True,
)
def disableAiModels(self) -> None:
self.run(
200,
self.run_mapping["enable_ai_models"],
False,
)
def updateMicHostList(self) -> None: def updateMicHostList(self) -> None:
self.run( self.run(
200, 200,
@@ -1754,6 +1768,12 @@ class Controller:
if isinstance(th_download_whisper, Thread): if isinstance(th_download_whisper, Thread):
th_download_whisper.join() th_download_whisper.join()
if (model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE) is False or
model.checkTranscriptionWhisperModelWeight(config.WHISPER_WEIGHT_TYPE) is False):
self.disableAiModels()
else:
self.enableAiModels()
for engine in config.SELECTABLE_TRANSLATION_ENGINE_LIST: for engine in config.SELECTABLE_TRANSLATION_ENGINE_LIST:
match engine: match engine:
case "CTranslate2": case "CTranslate2":

View File

@@ -9,6 +9,7 @@ from utils import printLog, printResponse, errorLogging, encodeBase64
run_mapping = { run_mapping = {
"connected_network":"/run/connected_network", "connected_network":"/run/connected_network",
"enable_ai_models":"/run/enable_ai_models",
"transcription_mic":"/run/transcription_send_mic_message", "transcription_mic":"/run/transcription_send_mic_message",
"transcription_speaker":"/run/transcription_receive_speaker_message", "transcription_speaker":"/run/transcription_receive_speaker_message",