Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.
fix: add exception handling to LLMClient to return original text on failure
Rishabh Bajpaicc0c84c80f6e
diff --git a/app/src/main/java/com/gotcha/llm/LLMClient.kt b/app/src/main/java/com/gotcha/llm/LLMClient.ktindex 04aa6ba..457d0f8 100644--- a/app/src/main/java/com/gotcha/llm/LLMClient.kt+++ b/app/src/main/java/com/gotcha/llm/LLMClient.kt@@ -110,8 +110,13 @@ class LLMClient(ChatMessage(role = "system", content = kotlinx.serialization.json.JsonPrimitive(prompt)),ChatMessage(role = "user", content = kotlinx.serialization.json.JsonPrimitive(text)))- val response = chat(messages = messages, temperature = 0f, modelOverride = modelOverride)- return response.choices.firstOrNull()?.message?.textContent ?: text+ return try {+ val response = chat(messages = messages, temperature = 0f, modelOverride = modelOverride)+ response.choices.firstOrNull()?.message?.textContent ?: text+ } catch (_: Exception) {+ // Fall back to original text if the LLM fails (e.g., 401 Unauthorized)+ text+ }}fun clearCache() {