Support Gemma4/Tinfoil in Duck.ai model picker#9059
Open
malmstein wants to merge 1 commit into
Open
Conversation
The /models endpoint now returns Gemma4 (id "tinfoil/gemma4-31b", provider "Tinfoil"), an open-source model served by Tinfoil. The app had no mapping for it, so it resolved to UNKNOWN and rendered without an icon in the native input model picker. Classify Tinfoil-provided models as OSS so Gemma4 reuses the existing OSS icon, matching the FE. Match on both the "tinfoil/" id prefix and the provider string, mirroring how meta-llama and mistralai are detected, so classification survives a missing or renamed provider field. Normalise the provider string to lowercase so backend capitalisation can no longer drop a model into UNKNOWN. Finally, fall back to the OSS icon for UNKNOWN providers so a model never renders without an icon again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task/Issue URL: https://app.asana.com/1/137249556945/project/1174433894299346/task/1216112317576899
Tech Design URL (if applicable):
Description
The
/modelsendpoint now returns Gemma4 (id: "tinfoil/gemma4-31b",provider: "Tinfoil"), an open-source model served by Tinfoil. The app had no mapping for it, so it resolved toUNKNOWNand rendered without an icon in the native input model picker.This PR:
OSS, so Gemma4 reuses the existingic_ai_model_oss_16icon — matching what FE does.tinfoil/id prefix and theproviderstring (mirroring howmeta-llama/mistralaiare detected), so classification survives a missing or renamed provider field."Tinfoil","OpenAI") can no longer silently drop a model intoUNKNOWN.UNKNOWNproviders, so a model never renders without an icon again (per discussion on the iOS task — Windows already has a fallback).Steps to test this PR
Gemma4 shows an icon in the model picker
internalcookie so Gemma4 is returned by/modelsUnknown-provider fallback
UI changes
Note
Low Risk
UI-only provider classification and icon display in the Duck.ai model picker; no auth, networking, or chat routing changes.
Overview
Tinfoil / Gemma4 models from
/modelsare now mapped toOSSinModelProvider.fromviatinfoil/id prefix andprovider: "tinfoil", aligned with FE. Provider strings are lowercased before matching so capitalized values (e.g."Tinfoil","OpenAI") no longer misclassify asUNKNOWN.The native model picker always shows a leading icon:
getIconResForModelreturns a non-null drawable andUNKNOWNuses the sameic_ai_model_oss_16fallback as OSS.ModelPickerView.setLeadingIconis simplified to require a drawable resource instead of optional icons.Reviewed by Cursor Bugbot for commit 1a24247. Bugbot is set up for automated code reviews on this repo. Configure here.