Merge branch 'bugfix_translation' into develop

This commit is contained in:
misyaguziya
2025-06-17 15:41:56 +09:00
2 changed files with 25 additions and 29 deletions

View File

@@ -322,23 +322,6 @@ class Controller:
"transliteration":transliteration "transliteration":transliteration
}) })
if model.checkWebSocketServerAlive() is True:
model.websocketSendMessage(
{
"type":"SENT",
"src_languages":config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO],
"dst_languages":config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO],
"message":message,
"translation":translation,
"transliteration":transliteration
}
)
if config.LOGGER_FEATURE is True:
if len(translation) > 0:
translation = " (" + "/".join(translation) + ")"
model.logger.info(f"[SENT] {message}{translation}")
if config.OVERLAY_LARGE_LOG is True and model.overlay.initialized is True: if config.OVERLAY_LARGE_LOG is True and model.overlay.initialized is True:
if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True: if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True:
if len(translation) > 0: if len(translation) > 0:
@@ -360,6 +343,22 @@ class Controller:
) )
model.updateOverlayLargeLog(overlay_image) model.updateOverlayLargeLog(overlay_image)
if model.checkWebSocketServerAlive() is True:
model.websocketSendMessage(
{
"type":"SENT",
"src_languages":config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO],
"dst_languages":config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO],
"message":message,
"translation":translation,
"transliteration":transliteration
}
)
if config.LOGGER_FEATURE is True:
translation_text = f" ({'/'.join(translation)})" if translation else ""
model.logger.info(f"[SENT] {message}{translation_text}")
def speakerMessage(self, result:dict) -> None: def speakerMessage(self, result:dict) -> None:
message = result["text"] message = result["text"]
language = result["language"] language = result["language"]
@@ -497,9 +496,8 @@ class Controller:
) )
if config.LOGGER_FEATURE is True: if config.LOGGER_FEATURE is True:
if len(translation) > 0: translation_text = f" ({'/'.join(translation)})" if translation else ""
translation = " (" + "/".join(translation) + ")" model.logger.info(f"[RECEIVED] {message}{translation_text}")
model.logger.info(f"[RECEIVED] {message}{translation}")
def chatMessage(self, data) -> None: def chatMessage(self, data) -> None:
id = data["id"] id = data["id"]
@@ -615,10 +613,8 @@ class Controller:
} }
) )
# update textbox message log (Chat)
if config.LOGGER_FEATURE is True: if config.LOGGER_FEATURE is True:
if len(translation) > 0: translation_text = f" ({'/'.join(translation)})" if translation else ""
translation_text = " (" + "/".join(translation) + ")"
model.logger.info(f"[CHAT] {message}{translation_text}") model.logger.info(f"[CHAT] {message}{translation_text}")
return {"status":200, return {"status":200,

View File

@@ -452,9 +452,9 @@ class Model:
config.MIC_AVG_LOGPROB, config.MIC_AVG_LOGPROB,
config.MIC_NO_SPEECH_PROB config.MIC_NO_SPEECH_PROB
) )
if res: if res:
result = self.mic_transcriber.getTranscript() result = self.mic_transcriber.getTranscript()
fnc(result) fnc(result)
except Exception: except Exception:
errorLogging() errorLogging()
@@ -635,9 +635,9 @@ class Model:
config.SPEAKER_AVG_LOGPROB, config.SPEAKER_AVG_LOGPROB,
config.SPEAKER_NO_SPEECH_PROB config.SPEAKER_NO_SPEECH_PROB
) )
if res: if res:
result = self.speaker_transcriber.getTranscript() result = self.speaker_transcriber.getTranscript()
fnc(result) fnc(result)
except Exception: except Exception:
errorLogging() errorLogging()