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.
refactor: update default LLM provider to Samosa AI and adjust related settings
Durganshu Mishra9cc8a87ccdad
diff --git a/app/src/main/java/com/gotcha/data/LlmProvider.kt b/app/src/main/java/com/gotcha/data/LlmProvider.ktindex 47d3a1f..3484223 100644--- a/app/src/main/java/com/gotcha/data/LlmProvider.kt+++ b/app/src/main/java/com/gotcha/data/LlmProvider.kt@@ -20,6 +20,6 @@ enum class LlmProvider(val label: String) {const val SAMOSA_BASE_URL = "https://api.samosa-ai.example/v1/"fun fromName(name: String?): LlmProvider =- entries.firstOrNull { it.name == name } ?: OPENAI_COMPATIBLE+ entries.firstOrNull { it.name == name } ?: SAMOSA_AI}}diff --git a/app/src/main/java/com/gotcha/data/SettingsRepository.kt b/app/src/main/java/com/gotcha/data/SettingsRepository.ktindex 57445eb..c9fedf6 100644--- a/app/src/main/java/com/gotcha/data/SettingsRepository.kt+++ b/app/src/main/java/com/gotcha/data/SettingsRepository.kt@@ -5,8 +5,8 @@ import android.content.SharedPreferencesimport com.gotcha.audio.AudioProviderdata class Settings(- // Which LLM backend is active. Defaults to the original OpenAI-compatible flow.- val provider: LlmProvider = LlmProvider.OPENAI_COMPATIBLE,+ // Which LLM backend is active. Defaults to the Samosa AI flow.+ val provider: LlmProvider = LlmProvider.SAMOSA_AI,val apiKey: String = "",val baseUrl: String = DEFAULT_BASE_URL,val model: String = DEFAULT_MODEL,@@ -140,9 +140,9 @@ data class Settings(/*** Whether credentials the user has actually *saved* would answer a question.*- * Stricter than [isConfigured], which an untouched install already satisfies- * because the default base URL is non-blank. The feature tour needs to tell- * "they have set this up" from "they have not started", and a step that+ * Stricter than [isConfigured], which on the Samosa default an untouched+ * install does not yet satisfy (no session token). The feature tour needs to+ * tell "they have set this up" from "they have not started", and a step that* considered itself finished before the user had done anything would be* exactly the kind of false progress the tour exists to avoid.*/@@ -235,7 +235,7 @@ data class Settings(companion object {const val DEFAULT_BASE_URL = "https://api.openai.com/v1/"- const val DEFAULT_MODEL = "gpt-4o"+ const val DEFAULT_MODEL = "chai-small"}}diff --git a/app/src/main/java/com/gotcha/llm/LLMClient.kt b/app/src/main/java/com/gotcha/llm/LLMClient.ktindex cce1763..57ea5de 100644--- a/app/src/main/java/com/gotcha/llm/LLMClient.kt+++ b/app/src/main/java/com/gotcha/llm/LLMClient.kt@@ -16,7 +16,7 @@ import java.security.MessageDigestclass LLMClient(private val apiKey: String,private val baseUrl: String,- private val model: String = "gpt-4o",+ private val model: String = "chai-small",context: Context? = null,private val apiTimeoutSeconds: Long = 0L,private val cache: LLMCache = LLMCache(context),diff --git a/app/src/test/java/com/gotcha/agent/AgentLoopTest.kt b/app/src/test/java/com/gotcha/agent/AgentLoopTest.ktindex 2f059e2..e5e1bc3 100644--- a/app/src/test/java/com/gotcha/agent/AgentLoopTest.kt+++ b/app/src/test/java/com/gotcha/agent/AgentLoopTest.kt@@ -3,6 +3,7 @@ package com.gotcha.agentimport android.content.Contextimport androidx.test.core.app.ApplicationProviderimport com.gotcha.data.ChatHistoryRepository+import com.gotcha.data.LlmProviderimport com.gotcha.data.Settingsimport com.gotcha.llm.LLMClientimport com.gotcha.testsupport.FakeAndroidKeyStore@@ -63,6 +64,7 @@ class AgentLoopTest {historyRepository = ChatHistoryRepository(context, "agent-loop-test-chats"),settingsProvider = {Settings(+ provider = LlmProvider.OPENAI_COMPATIBLE,apiKey = "test-key",baseUrl = server.url("/").toString(),// Keep the loop short so a scripted script that never terminates fails fast.diff --git a/app/src/test/java/com/gotcha/agent/ChatViewModelAutoReadTest.kt b/app/src/test/java/com/gotcha/agent/ChatViewModelAutoReadTest.ktindex f1721b1..1796bf3 100644--- a/app/src/test/java/com/gotcha/agent/ChatViewModelAutoReadTest.kt+++ b/app/src/test/java/com/gotcha/agent/ChatViewModelAutoReadTest.kt@@ -3,6 +3,7 @@ package com.gotcha.agentimport android.app.Applicationimport androidx.test.core.app.ApplicationProviderimport com.gotcha.audio.AudioProvider+import com.gotcha.data.LlmProviderimport com.gotcha.data.Settingsimport com.gotcha.data.SettingsRepositoryimport com.gotcha.testsupport.FakeAndroidKeyStore@@ -28,6 +29,7 @@ class ChatViewModelAutoReadTest {settingsRepository = SettingsRepository(application)settingsRepository.save(Settings(+ provider = LlmProvider.OPENAI_COMPATIBLE,autoReadReplies = false,ttsProvider = AudioProvider.ANDROID,apiKey = "test-api-key"diff --git a/app/src/test/java/com/gotcha/data/SettingsTest.kt b/app/src/test/java/com/gotcha/data/SettingsTest.ktindex 4c1c6b2..ff97127 100644--- a/app/src/test/java/com/gotcha/data/SettingsTest.kt+++ b/app/src/test/java/com/gotcha/data/SettingsTest.kt@@ -9,6 +9,7 @@ class SettingsTest {@Testfun `effectiveTtsApiKey falls back to effectiveApiKey when ttsApiKey is blank and provider is API`() {val settings = Settings(+ provider = LlmProvider.OPENAI_COMPATIBLE,apiKey = "main-key",ttsProvider = AudioProvider.API,ttsApiKey = ""@@ -29,6 +30,7 @@ class SettingsTest {@Testfun `effectiveSttApiKey falls back to effectiveApiKey when sttApiKey is blank and provider is API`() {val settings = Settings(+ provider = LlmProvider.OPENAI_COMPATIBLE,apiKey = "main-key",sttProvider = AudioProvider.API,sttApiKey = ""@@ -252,12 +254,15 @@ class SettingsTest {}@Test- fun `an untouched install satisfies isConfigured but has no usable model`() {- // The distinction the feature tour turns on: the default base URL is- // non-blank, so isConfigured alone would call a brand new install ready.+ fun `an untouched install is not configured until a Samosa sign-in`() {+ // The default provider is Samosa AI and the model chai-small, so a brand+ // new install has neither a session token nor an API key — the feature+ // tour must treat it as not started.val settings = Settings()- assertEquals(true, settings.isConfigured)+ assertEquals(LlmProvider.SAMOSA_AI, settings.provider)+ assertEquals("chai-small", settings.model)+ assertEquals(false, settings.isConfigured)assertEquals(false, settings.hasUsableModel)}