()
| 56 | |
| 57 | |
| 58 | def check_lm_studio(): |
| 59 | try: |
| 60 | request = Request(f"{OPENAI_BASE_URL}/models") |
| 61 | with urlopen(request, timeout=3) as response: |
| 62 | data = json.loads(response.read().decode("utf-8")) |
| 63 | models = [item.get("id", "") for item in data.get("data", [])] |
| 64 | if OPENAI_MODEL in models: |
| 65 | say(f"LM Studio connected: {OPENAI_MODEL}") |
| 66 | else: |
| 67 | say("LM Studio is running, but the selected model was not listed.") |
| 68 | except Exception as exc: |
| 69 | say(f"LM Studio not ready: {exc}") |
| 70 | |
| 71 | |
| 72 | def handle_command(user_input): |
no test coverage detected