[Update] Controller: Add methods for LMStudio and Ollama connection status checks

This commit is contained in:
misyaguziya
2025-11-24 18:01:30 +09:00
parent 8cc9255fd0
commit 9a35577ec6
6 changed files with 61 additions and 18 deletions

View File

@@ -176,6 +176,16 @@ class Translator:
"""Update the OpenAI client (fetch available models)."""
self.openai_client.updateClient()
def getLMStudioConnected(self) -> bool:
"""Get LM Studio connection status.
Returns True if connected, False otherwise.
"""
if self.lmstudio_client is None:
return False
else:
return True
def setLMStudioClientURL(self, base_url: str | None = None, root_path: str = None) -> bool:
"""Authenticate LM Studio with the provided base URL.
@@ -207,6 +217,16 @@ class Translator:
"""Update the LM Studio client (fetch available models)."""
self.lmstudio_client.updateClient()
def getOllamaConnected(self) -> bool:
"""Get Ollama connection status.
Returns True if connected, False otherwise.
"""
if self.ollama_client is None:
return False
else:
return True
def checkOllamaClient(self, root_path: str = None) -> bool:
"""Check if Ollama client is available.