fix(mobile): show OpenCode model sources in picker (#8573)
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
f94a0d646e
commit
acb599d2dc
5 files changed
+97
-18
No files matched your search
@@ -93,7 +93,7 @@ function ModelRow(props: {
|
||||
}) {
|
||||
return (
|
||||
<Pressable
|
||||
accessibilityLabel={props.option.label}
|
||||
accessibilityLabel={[props.option.label, props.option.subtitle].filter(Boolean).join(", ")}
|
||||
accessibilityRole="radio"
|
||||
accessibilityState={{ checked: props.selected }}
|
||||
onPress={props.onPress}
|
||||
@@ -103,20 +103,31 @@ function ModelRow(props: {
|
||||
props.isLast ? "rounded-b-2xl" : "border-b border-border-subtle",
|
||||
)}
|
||||
>
|
||||
<Text className="min-w-0 shrink text-base font-t3-medium text-foreground" numberOfLines={1}>
|
||||
{props.option.label}
|
||||
</Text>
|
||||
{props.option.isDefault ? (
|
||||
<View className="rounded-md bg-subtle-strong px-1.5 py-0.5">
|
||||
<Text className="text-3xs font-t3-bold text-foreground-muted">Default</Text>
|
||||
<View className="min-w-0 flex-1">
|
||||
<View className="flex-row items-center gap-2">
|
||||
<Text
|
||||
className="min-w-0 shrink text-base font-t3-medium text-foreground"
|
||||
numberOfLines={1}
|
||||
>
|
||||
{props.option.label}
|
||||
</Text>
|
||||
{props.option.isDefault ? (
|
||||
<View className="rounded-md bg-subtle-strong px-1.5 py-0.5">
|
||||
<Text className="text-3xs font-t3-bold text-foreground-muted">Default</Text>
|
||||
</View>
|
||||
) : null}
|
||||
{props.option.isLegacy ? (
|
||||
<View className="rounded-md bg-subtle px-1.5 py-0.5">
|
||||
<Text className="text-3xs font-t3-bold text-foreground-muted">Legacy</Text>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
) : null}
|
||||
{props.option.isLegacy ? (
|
||||
<View className="rounded-md bg-subtle px-1.5 py-0.5">
|
||||
<Text className="text-3xs font-t3-bold text-foreground-muted">Legacy</Text>
|
||||
</View>
|
||||
) : null}
|
||||
<View className="flex-1" />
|
||||
{props.option.subtitle ? (
|
||||
<Text className="text-xs text-foreground-muted" numberOfLines={1}>
|
||||
{props.option.subtitle}
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
{props.selected ? (
|
||||
<SymbolView
|
||||
name="checkmark"
|
||||
|
||||
@@ -12,7 +12,7 @@ function modelOption(
|
||||
return {
|
||||
key: `codex:${model}`,
|
||||
label: model,
|
||||
subtitle: "Codex",
|
||||
subtitle: "",
|
||||
providerKey: "codex",
|
||||
providerLabel: "Codex",
|
||||
providerDriver: "codex",
|
||||
@@ -48,6 +48,21 @@ describe("thread settings sheet state", () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("matches the upstream provider's display name", () => {
|
||||
const model = {
|
||||
...modelOption("opencode/claude-fable-5"),
|
||||
label: "Claude Fable 5",
|
||||
subtitle: "OpenCode Zen",
|
||||
};
|
||||
|
||||
expect(modelMatchesCatalogQuery({ model, providerLabel: "OpenCode", query: " ZEN " })).toBe(
|
||||
true,
|
||||
);
|
||||
expect(modelMatchesCatalogQuery({ model, providerLabel: "OpenCode", query: "copilot" })).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("clears staging when the applied model is pressed", () => {
|
||||
expect(
|
||||
pendingModelAfterPress({
|
||||
|
||||
@@ -44,13 +44,62 @@ describe("mobile model options", () => {
|
||||
providerKey: "codex",
|
||||
providerLabel: "Codex",
|
||||
models: [
|
||||
{ key: "codex:gpt-5.6-sol", label: "GPT-5.6 Sol", isLegacy: false },
|
||||
{ key: "codex:gpt-5.6-sol", label: "GPT-5.6 Sol", subtitle: "", isLegacy: false },
|
||||
{ key: "codex:gpt-5.4", label: "GPT-5.4", isLegacy: true },
|
||||
],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("distinguishes same-name OpenCode models without changing their routing", () => {
|
||||
const sources = [
|
||||
{ id: "anthropic", label: "Anthropic" },
|
||||
{ id: "github-copilot", label: "GitHub Copilot" },
|
||||
{ id: "opencode", label: "OpenCode Zen" },
|
||||
];
|
||||
const config = {
|
||||
providers: [
|
||||
{
|
||||
instanceId: "opencode_work",
|
||||
driver: "opencode",
|
||||
displayName: "OpenCode Work",
|
||||
enabled: true,
|
||||
installed: true,
|
||||
auth: { status: "authenticated" },
|
||||
models: sources.map((source) => ({
|
||||
slug: `${source.id}/claude-fable-5`,
|
||||
name: "Claude Fable 5",
|
||||
subProvider: source.label,
|
||||
isCustom: false,
|
||||
capabilities: null,
|
||||
})),
|
||||
},
|
||||
],
|
||||
} as unknown as ServerConfig;
|
||||
const selection = {
|
||||
instanceId: ProviderInstanceId.make("opencode_work"),
|
||||
model: "github-copilot/claude-fable-5",
|
||||
};
|
||||
|
||||
const options = buildModelOptions(config, selection);
|
||||
|
||||
expect(options).toMatchObject(
|
||||
sources.map((source) => ({
|
||||
key: `opencode_work:${source.id}/claude-fable-5`,
|
||||
label: "Claude Fable 5",
|
||||
subtitle: source.label,
|
||||
providerLabel: "OpenCode Work",
|
||||
selection: {
|
||||
instanceId: "opencode_work",
|
||||
model: `${source.id}/claude-fable-5`,
|
||||
},
|
||||
})),
|
||||
);
|
||||
expect(groupByProvider(options)).toEqual([
|
||||
{ providerKey: "opencode_work", providerLabel: "OpenCode Work", models: options },
|
||||
]);
|
||||
});
|
||||
|
||||
it("normalizes a legacy fallback selection against current capabilities", () => {
|
||||
const config = {
|
||||
providers: [
|
||||
|
||||
@@ -121,7 +121,7 @@ export function buildModelOptions(
|
||||
options.set(key, {
|
||||
key,
|
||||
label: model.name,
|
||||
subtitle: providerLabel,
|
||||
subtitle: model.subProvider ?? "",
|
||||
providerKey: provider.instanceId,
|
||||
providerLabel,
|
||||
providerDriver: provider.driver,
|
||||
@@ -152,7 +152,7 @@ export function buildModelOptions(
|
||||
options.set(key, {
|
||||
key,
|
||||
label: fallbackModelSelection.model,
|
||||
subtitle: providerLabel,
|
||||
subtitle: "",
|
||||
providerKey: fallbackModelSelection.instanceId,
|
||||
providerLabel,
|
||||
providerDriver: fallbackModelSelection.instanceId,
|
||||
|
||||
@@ -10,6 +10,10 @@ becomes available after every upload finishes. Failed uploads can be retried or
|
||||
On web and desktop, HEIC and HEIF photos are automatically converted to JPEG when you drag them into
|
||||
the composer or paste them into a message.
|
||||
|
||||
On mobile, the model picker shows each OpenCode model's upstream provider, such as Anthropic,
|
||||
GitHub Copilot, or OpenCode Zen, beneath its name. Search by that provider name to narrow the list
|
||||
when starting a thread or changing an existing thread's model.
|
||||
|
||||
## Commands and skills
|
||||
|
||||
Type `/` to open the command menu. Type `$` to find and add a skill. Skill rows show their source,
|
||||
|
||||
Reference in new issue
Block a user