Skip to content

armgit / fx0

Public Imported from GitHub
0

A lightweight design agent built with libfx. Describe a page and an agent writes it as one HTML file.

TypeScript

Name the guest's locked model by its slug, as the picker does

Esteban Suarezf770b9f76e38
diff --git a/components/composer.tsx b/components/composer.tsx
index a6c90fb..7aad16e 100644
--- a/components/composer.tsx
+++ b/components/composer.tsx
@@ -690,7 +690,10 @@ export default function Composer({
const intrinsicFast = Boolean(fastBase) && (models.length === 0 || models.includes(fastBase))
const resolvedModel = intrinsicFast ? fastBase : pickedModel
const fastOn = trial || fast || intrinsicFast
- const modelLabel = trial ? 'Opus 5.5 Fast' : resolvedModel ? (resolvedModel.split('/').at(-1) ?? resolvedModel) : 'Model'
+ const modelLabel = resolvedModel ? (resolvedModel.split('/').at(-1) ?? resolvedModel) : 'Model'
+ // The trial model by its slug, as the picker lists it: the base model when the catalog has it.
+ const trialBase = TRIAL_MODEL.slice(0, -'-fast'.length)
+ const trialLabel = (models.length === 0 || models.includes(trialBase) ? trialBase : TRIAL_MODEL).split('/').at(-1)
// The static shell cannot know browser preferences or a chat's stored model.
// Reserve its space until that session's selection is known, never paint a
// different model while cookies or shared chat settings are being restored.
@@ -933,9 +936,9 @@ export default function Composer({
/>
{trialRegion((isTrial) => isTrial ? (
- <Button variant="ghost" size="sm" disabled aria-label="Model: Opus 5.5 Fast"
+ <Button variant="ghost" size="sm" disabled aria-label={`Model: ${trialLabel}`}
className="h-8 min-w-0 max-w-44 flex-1 justify-start px-2 text-sm font-normal text-muted-foreground">
- <span className="truncate">Opus 5.5 Fast</span>
+ <span className="truncate">{trialLabel}</span>
</Button>
) : <Popover
open={modelPickerOpen}
diff --git a/tests/guest-ui.test.mjs b/tests/guest-ui.test.mjs
index d74ace9..e44ca91 100644
--- a/tests/guest-ui.test.mjs
+++ b/tests/guest-ui.test.mjs
@@ -184,7 +184,7 @@ test('a trial guest sends without sign-in or draft reservation and updates the r
const composer = find(app.tree(), (node) => node.type === Composer)
composer.props.onDraftInput('Make a design')
assert.equal(find(app.tree(), (node) => node.type === Sidebar).props.user, null, 'a trial identity is not an OAuth account')
- assert.equal(find(app.composerTree(), (node) => node.props?.['aria-label'] === 'Model: Opus 5.5 Fast').props.disabled, true)
+ assert.equal(find(app.composerTree(), (node) => /^Model: claude-opus-5\.5/.test(node.props?.['aria-label'] ?? '')).props.disabled, true)
assert.equal(find(app.composerTree(), (node) => node.props?.['aria-label'] === 'reasoning effort: high'), null)
assert.deepEqual(app.handle().getGeneration(), { model: trialModel, effort: 'low', fast: true, defaultModel: 'default-model' })
app.handle().restoreDraft(draft)
diff --git a/tests/html-ui.test.mjs b/tests/html-ui.test.mjs
index 687ca86..c5369fd 100644
--- a/tests/html-ui.test.mjs
+++ b/tests/html-ui.test.mjs
@@ -85,7 +85,7 @@ test('trial first paint offers sign-in, free prompts and a fixed model while ret
assert.match(markup, />Sign in</)
assert.doesNotMatch(markup, /Account: You|billing team/)
assert.match(markup, /3 free prompts left/)
- assert.match(markup, /disabled="" aria-label="Model: Opus 5\.5 Fast"/)
+ assert.match(markup, /disabled="" aria-label="Model: claude-opus-5\.5(-fast)?"/)
assert.match(markup, /Guest design|My trial prompt/)
assert.match(markup, /\/api\/artifact-frame\?session=trial-chat&amp;v=2/)
})