From bf7d2e61a7db6bf5a76628177d5213b46689c717 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 10 Jan 2026 23:50:36 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20=E7=BF=BB=E8=A8=B3=E8=80=85=E3=82=AF?= =?UTF-8?q?=E3=83=A9=E3=82=B9=E3=81=ABLM=20Studio=E3=81=8A=E3=82=88?= =?UTF-8?q?=E3=81=B3Ollama=E3=81=AE=E6=8E=A5=E7=B6=9A=E7=8A=B6=E6=85=8B?= =?UTF-8?q?=E3=82=92=E7=AE=A1=E7=90=86=E3=81=99=E3=82=8B=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../translation/translation_translator.py | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src-python/models/translation/translation_translator.py b/src-python/models/translation/translation_translator.py index d311f88a..ff2e93cf 100644 --- a/src-python/models/translation/translation_translator.py +++ b/src-python/models/translation/translation_translator.py @@ -57,7 +57,9 @@ class Translator: self.groq_client: Optional[GroqClient] = None self.openrouter_client: Optional[OpenRouterClient] = None self.lmstudio_client: LMStudioClient[LMStudioClient] = None + self.lmstudio_connected: bool = False self.ollama_client: OllamaClient[OllamaClient] = None + self.ollama_connected: bool = False self.ctranslate2_translator: Any = None self.ctranslate2_tokenizer: Any = None self.is_loaded_ctranslate2_model: bool = False @@ -123,6 +125,7 @@ class Translator: if self.gemini_client.setAuthKey(auth_key): return True else: + self.gemini_client = None return False def getGeminiModelList(self) -> list[str]: @@ -253,12 +256,9 @@ class Translator: def getLMStudioConnected(self) -> bool: """Get LM Studio connection status. - Returns True if connected, False otherwise. + Returns True if connected and verified, False otherwise. """ - if self.lmstudio_client is None: - return False - else: - return True + return self.lmstudio_connected def setLMStudioClientURL(self, base_url: str | None = None, root_path: str = None) -> bool: """Authenticate LM Studio with the provided base URL. @@ -269,6 +269,9 @@ class Translator: result = self.lmstudio_client.setBaseURL(base_url) if result is False: self.lmstudio_client = None + self.lmstudio_connected = False + else: + self.lmstudio_connected = True return result def getLMStudioModelList(self) -> list[str]: @@ -294,12 +297,9 @@ class Translator: def getOllamaConnected(self) -> bool: """Get Ollama connection status. - Returns True if connected, False otherwise. + Returns True if connected and verified, False otherwise. """ - if self.ollama_client is None: - return False - else: - return True + return self.ollama_connected def checkOllamaClient(self, root_path: str = None) -> bool: """Check if Ollama client is available. @@ -310,6 +310,9 @@ class Translator: result = self.ollama_client.authenticationCheck() if result is False: self.ollama_client = None + self.ollama_connected = False + else: + self.ollama_connected = True return result def getOllamaModelList(self, root_path: str = None) -> bool: