-
Notifications
You must be signed in to change notification settings - Fork 7.4k
fix(web): gate Finalize design package + trim handling reviewers asked for on #1649 #1749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2294,11 +2294,25 @@ export function ProjectView({ | |
| // Continue in CLI / Finalize design package handlers + keyboard | ||
| // shortcut wiring. Close to the JSX so the data flow is easy to | ||
| // trace from the toolbar back to its sources. | ||
|
|
||
| // Check if finalize is available: requires apiKey and model (#1348) | ||
| const canFinalize = Boolean(config.apiKey?.trim() && config.model?.trim()); | ||
|
|
||
| const handleFinalize = useCallback(() => { | ||
| // Guard against missing config (should be prevented by disabled state, | ||
| // but defend in depth in case the button is triggered programmatically) | ||
| if (!config.apiKey?.trim() || !config.model?.trim()) { | ||
| setProjectActionsToast({ | ||
| message: 'Cannot finalize: API key and model are required.', | ||
| details: 'Configure your provider in Settings before finalizing.', | ||
| }); | ||
| return; | ||
| } | ||
|
|
||
| void finalize.trigger({ | ||
| apiKey: config.apiKey, | ||
| apiKey: config.apiKey.trim(), | ||
| baseUrl: config.baseUrl, | ||
| model: config.model, | ||
| model: config.model.trim(), | ||
| maxTokens: effectiveMaxTokens(config), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| }).then((result) => { | ||
| if (result) void designMdState.refresh(); | ||
|
|
@@ -2500,6 +2514,7 @@ export function ProjectView({ | |
| <ProjectActionsToolbar | ||
| designMdState={designMdState} | ||
| finalizeStatus={finalize.status} | ||
| canFinalize={canFinalize} | ||
| onFinalize={handleFinalize} | ||
| onCancelFinalize={handleCancelFinalize} | ||
| onContinueInCli={handleContinueInCli} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the saved model has leading/trailing whitespace, this path now correctly sends
model: config.model.trim(), buteffectiveMaxTokens(config)still looks up the untrimmed value. In that scenario, known models likeclaude-sonnet-4-5miss their model-specific default and fall back to 8192 tokens, so finalization can be unnecessarily truncated even though the request uses the trimmed model. Compute the token cap from the same trimmed model that is sent to the daemon.Useful? React with 👍 / 👎.