Repository navigation
feat(settings): real-time dynamic Gemini/Groq model lists + bundle dependabot updates - #162
Musheer360 wants to merge 9 commits into
Conversation
…points Replaces the two hardcoded two-model dropdowns with lists fetched from each provider's models endpoint (issue #148): - GeminiClient.fetchModels(): paginated GET v1beta/models keeping only generateContent-capable entries (fail-open when the capability array is absent); error mapping mirrors validateKey - Groq rides the existing OpenAI-compatible prober against its fixed endpoint; whisper/tts/guard entries filtered client-side - auto-fetch once per process per provider, session-only cache (ProviderModelsCache) so tab switches don't refetch; manual Refresh, inline failure message + Retry path; no-key hint state - dropdown capped at 320dp and scrolls for long catalogs - sanitize() passes unknown ids through trimmed; only blank values and known-retired ids migrate to DEFAULT (RETIRED_IDS) - strings translated across all 40 locales Verified: :app:testDebugUnitTest and :app:lintDebug green.
Addresses the copilot review on PR #153: nextPageToken may contain '+', '/' or '=' which corrupt the query string when interpolated raw. Also removes the now-stale English-fallback TODO, since this branch ships all locale translations.
Bumps androidx.compose:compose-bom from 2026.06.01 to 2026.08.00. --- updated-dependencies: - dependency-name: androidx.compose:compose-bom dependency-version: 2026.08.00 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/github-script](https://github.com/actions/github-script) from 7.1.0 to 9.0.0. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@f28e40c...3a2844b) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps com.android.application from 9.3.1 to 9.3.2. --- updated-dependencies: - dependency-name: com.android.application dependency-version: 9.3.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 5.7.0 to 6.0.0. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](actions/setup-java@b6effb0...dd06d9c) --- updated-dependencies: - dependency-name: actions/setup-java dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [gradle-wrapper](https://github.com/gradle/gradle) from 9.7.0 to 9.7.1. - [Release notes](https://github.com/gradle/gradle/releases) - [Commits](gradle/gradle@v9.7.0...v9.7.1) --- updated-dependencies: - dependency-name: gradle-wrapper dependency-version: 9.7.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The provider model-fetch cache currently only records “attempted” on non-empty success, which can cause repeated auto-fetching behavior and conflicts with the cache contract.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds dynamic, live-fetched model catalogs for Gemini and Groq in Settings (with session caching + refreshed localization), while consolidating several dependency/tooling upgrades (Gradle/AGP/Compose BOM + GitHub Actions).
Changes:
- Implement provider-backed
/modelslisting for Gemini/Groq and render read-only, scrollable dynamic dropdowns in Settings, with session cache and refresh affordance. - Update model normalization for Gemini/Groq to allow trimmed pass-through of dynamic IDs while migrating known-retired IDs to defaults; add/adjust unit tests accordingly.
- Apply consolidated dependency and CI workflow bumps (Gradle wrapper, AGP plugin, Compose BOM,
actions/github-script,actions/setup-java) plus new localized strings.
File summaries
| File | Description |
|---|---|
| gradle/wrapper/gradle-wrapper.properties | Bumps Gradle wrapper to 9.7.1 with updated SHA. |
| build.gradle.kts | Bumps Android Gradle plugin version to 9.3.2 (apply false). |
| app/build.gradle.kts | Updates Compose BOM to 2026.08.00. |
| .github/workflows/preview-comment.yml | Updates actions/github-script pin to v9.0.0 commit. |
| .github/workflows/build.yml | Updates actions/setup-java pin to v6.0.0 commit. |
| app/src/main/java/com/musheer360/swiftslate/ui/SettingsScreen.kt | Adds dynamic Gemini/Groq dropdowns, background model fetch, refresh UI, and per-provider status messaging. |
| app/src/main/java/com/musheer360/swiftslate/api/GeminiClient.kt | Adds Gemini models listing (fetchModels) and JSON parsing helper for /models. |
| app/src/main/java/com/musheer360/swiftslate/manager/ProviderModelsCache.kt | Introduces process-lifetime cache for provider model lists and “attempted” tracking. |
| app/src/main/java/com/musheer360/swiftslate/model/GeminiModels.kt | Updates sanitize behavior to allow trimmed pass-through except for blank/retired IDs. |
| app/src/main/java/com/musheer360/swiftslate/model/GroqModels.kt | Adds retired IDs list, chat-candidate filtering helper, and updated sanitize behavior. |
| app/src/test/java/com/musheer360/swiftslate/api/GeminiModelsListParserTest.kt | Adds parser unit tests for Gemini /models responses (Robolectric). |
| app/src/test/java/com/musheer360/swiftslate/model/CatalogTest.kt | Updates tests for new sanitize behavior and Groq chat-candidate filtering. |
| app/src/test/java/com/musheer360/swiftslate/provider/ProviderConfigTest.kt | Updates Gemini config test to cover dynamic ID pass-through. |
| app/src/main/res/values/strings.xml | Adds new Settings strings for refresh/need-key/failure/empty-provider states. |
| app/src/main/res/values-ar/strings.xml | Translates new Settings strings (Arabic). |
| app/src/main/res/values-bg/strings.xml | Translates new Settings strings (Bulgarian). |
| app/src/main/res/values-ca/strings.xml | Translates new Settings strings (Catalan). |
| app/src/main/res/values-cs/strings.xml | Translates new Settings strings (Czech). |
| app/src/main/res/values-da/strings.xml | Translates new Settings strings (Danish). |
| app/src/main/res/values-de/strings.xml | Translates new Settings strings (German). |
| app/src/main/res/values-el/strings.xml | Translates new Settings strings (Greek). |
| app/src/main/res/values-es/strings.xml | Translates new Settings strings (Spanish). |
| app/src/main/res/values-et/strings.xml | Translates new Settings strings (Estonian). |
| app/src/main/res/values-fa/strings.xml | Translates new Settings strings (Persian). |
| app/src/main/res/values-fi/strings.xml | Translates new Settings strings (Finnish). |
| app/src/main/res/values-fr/strings.xml | Translates new Settings strings (French). |
| app/src/main/res/values-hi/strings.xml | Translates new Settings strings (Hindi). |
| app/src/main/res/values-hr/strings.xml | Translates new Settings strings (Croatian). |
| app/src/main/res/values-hu/strings.xml | Translates new Settings strings (Hungarian). |
| app/src/main/res/values-in/strings.xml | Translates new Settings strings (Indonesian). |
| app/src/main/res/values-it/strings.xml | Translates new Settings strings (Italian). |
| app/src/main/res/values-iw/strings.xml | Translates new Settings strings (Hebrew). |
| app/src/main/res/values-ja/strings.xml | Translates new Settings strings (Japanese). |
| app/src/main/res/values-ko/strings.xml | Translates new Settings strings (Korean). |
| app/src/main/res/values-lt/strings.xml | Translates new Settings strings (Lithuanian). |
| app/src/main/res/values-lv/strings.xml | Translates new Settings strings (Latvian). |
| app/src/main/res/values-ms/strings.xml | Translates new Settings strings (Malay). |
| app/src/main/res/values-nb/strings.xml | Translates new Settings strings (Norwegian Bokmål). |
| app/src/main/res/values-nl/strings.xml | Translates new Settings strings (Dutch). |
| app/src/main/res/values-pl/strings.xml | Translates new Settings strings (Polish). |
| app/src/main/res/values-pt/strings.xml | Translates new Settings strings (Portuguese). |
| app/src/main/res/values-pt-rBR/strings.xml | Translates new Settings strings (Portuguese, Brazil). |
| app/src/main/res/values-ro/strings.xml | Translates new Settings strings (Romanian). |
| app/src/main/res/values-ru/strings.xml | Translates new Settings strings (Russian). |
| app/src/main/res/values-sk/strings.xml | Translates new Settings strings (Slovak). |
| app/src/main/res/values-sl/strings.xml | Translates new Settings strings (Slovenian). |
| app/src/main/res/values-sr/strings.xml | Translates new Settings strings (Serbian). |
| app/src/main/res/values-sv/strings.xml | Translates new Settings strings (Swedish). |
| app/src/main/res/values-th/strings.xml | Translates new Settings strings (Thai). |
| app/src/main/res/values-tr/strings.xml | Translates new Settings strings (Turkish). |
| app/src/main/res/values-uk/strings.xml | Translates new Settings strings (Ukrainian). |
| app/src/main/res/values-vi/strings.xml | Translates new Settings strings (Vietnamese). |
| app/src/main/res/values-zh/strings.xml | Translates new Settings strings (Chinese). |
| app/src/main/res/values-zh-rCN/strings.xml | Translates new Settings strings (Chinese, China). |
Review details
- Files reviewed: 53/54 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| val models = result.getOrNull().orEmpty() | ||
| val success = result.isSuccess && models.isNotEmpty() | ||
| val message = when { | ||
| result.isSuccess && models.isEmpty() -> modelsEmptyProviderMsg | ||
| result.isSuccess -> String.format(modelsLoadedMsg, models.size) | ||
| else -> modelsLoadFailedMsg | ||
| } | ||
| if (success) { | ||
| ProviderModelsCache.put(type, ProviderModelsCache.Entry(models, attempted = true)) | ||
| } |
| DropdownMenuItem( | ||
| text = { | ||
| Text( | ||
| text = if (!enabled) needKeyText else stringResource(R.string.settings_fetch_models_empty), | ||
| fontSize = 13.sp, |
📦 Preview APK — PR #162 ·
|
…provider-specific empty text
What does this PR do?
Resolves #148. Supersedes and consolidates #153 and all open Dependabot PRs (#149, #150, #156, #157, #158) into a single unified release candidate.
Real-Time Dynamic Model Dropdown (Gemini & Groq)
onExpandedChange) triggers a live asynchronous query to the provider's/modelsendpoint in the background.CircularProgressIndicator+settings_fetch_models_loading) appears at the top of the menu, followed by aSlateDivider. Once fetched, the menu recomposes in place.SlateTextField(readOnly = true, PrimaryNotEditable)so users select valid active models without manual typing errors.Modifier.heightIn(max = 300.dp)with smooth vertical scroll so large catalogs (50+ models) stay compact.RoundedCornerShape(10.dp),MaterialTheme.colorScheme.surface,primary,onSurface,SlateTextField,SlateDivider).GeminiModels.ALLandGroqModels.ALL) without clearing the list.Provider Listing Contracts
GET v1beta/models): ImplementsGeminiClient.fetchModels(apiKey). CheckssupportedGenerationMethods/supportedActionsfor"generateContent", strips"models/"prefix, and safely URL-encodesnextPageToken(up to 3 pages).GET /openai/v1/models): Probes endpoint viaOpenAICompatibleClient.fetchModelsand filters out audio (whisper), TTS (playai,-tts), and safety classifiers (guard) viaGroqModels.isChatCandidate.sanitize): UpdatesGeminiModels.sanitizeandGroqModels.sanitizeto pass through trimmed dynamic IDs while migrating retired IDs (gemini-2.5-flash-lite,llama-3.3-70b-versatile) toDEFAULT.Consolidated Dependabot Upgrades
androidx.compose:compose-bomfrom2026.06.01to2026.08.00(chore(deps): bump androidx.compose:compose-bom from 2026.06.01 to 2026.08.00 #149)actions/github-scriptfrom7.1.0to9.0.0(chore(deps): bump actions/github-script from 7.1.0 to 9.0.0 #150)com.android.applicationfrom9.3.1to9.3.2(chore(deps): bump com.android.application from 9.3.2 to 9.4.0 #156)actions/setup-javafrom5.7.0to6.0.0(chore(deps): bump actions/setup-java from 5.7.0 to 6.0.0 #157)gradle-wrapperfrom9.7.0to9.7.1(chore(deps): bump gradle-wrapper from 9.7.0 to 9.7.1 #158)Testing
GeminiModelsListParserTest,CatalogTest,ProviderConfigTest. Full./gradlew testDebugUnitTestpassing cleanly on Gradle 9.7.1 and AGP 9.3.2../gradlew :app:lintDebugpassing with 0 errors across all 40+ locales.