Skip to content

Support Gemma4/Tinfoil in Duck.ai model picker#9059

Open
malmstein wants to merge 1 commit into
developfrom
feature/david/gemma4_model_picker_icon
Open

Support Gemma4/Tinfoil in Duck.ai model picker#9059
malmstein wants to merge 1 commit into
developfrom
feature/david/gemma4_model_picker_icon

Conversation

@malmstein

@malmstein malmstein commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/1174433894299346/task/1216112317576899
Tech Design URL (if applicable):

Description

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.

This PR:

  • Classifies Tinfoil-provided models as OSS, so Gemma4 reuses the existing ic_ai_model_oss_16 icon — matching what FE does.
  • Matches on both the tinfoil/ id prefix and the provider string (mirroring how meta-llama / mistralai are detected), so classification survives a missing or renamed provider field.
  • Normalises the provider string to lowercase, so backend capitalisation (e.g. "Tinfoil", "OpenAI") can no longer silently drop a model into UNKNOWN.
  • Falls back to the OSS icon for UNKNOWN providers, 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

  • Build an internal flavour with the internal cookie so Gemma4 is returned by /models
  • Open Duck.ai → native input → model picker
  • Confirm Gemma4 appears with the OSS icon (same as GPT-OSS-120b), not blank

Unknown-provider fallback

  • Confirm any model with an unrecognised provider shows the OSS icon rather than no icon

UI changes

Before After
(Gemma4 with no icon) (Gemma4 with OSS icon)

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 /models are now mapped to OSS in ModelProvider.from via tinfoil/ id prefix and provider: "tinfoil", aligned with FE. Provider strings are lowercased before matching so capitalized values (e.g. "Tinfoil", "OpenAI") no longer misclassify as UNKNOWN.

The native model picker always shows a leading icon: getIconResForModel returns a non-null drawable and UNKNOWN uses the same ic_ai_model_oss_16 fallback as OSS. ModelPickerView.setLeadingIcon is 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.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant