-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: add reasoning effort slider to the chat model selector #26977
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 |
|---|---|---|
|
|
@@ -157,6 +157,7 @@ const getCreateOptions = (onCreateChat: unknown): CreateChatSubmission => { | |
|
|
||
| type CreateChatSubmission = { | ||
| model?: string; | ||
| reasoningEffort?: string; | ||
| }; | ||
|
|
||
| export const RootPersonalModelOverrideModelSelected: Story = { | ||
|
|
@@ -305,6 +306,64 @@ export const ManualSelectionOverridesRootChatDefault: Story = { | |
| }, | ||
| }; | ||
|
|
||
| // Model options with reasoning effort bounds configured. GPT-4o uses the | ||
| // full global scale; Claude is capped at medium. | ||
| const effortModelOptions = [ | ||
| { | ||
| ...modelOptions[0], | ||
| reasoningEffortDefault: "medium", | ||
| reasoningEfforts: [ | ||
| "none", | ||
| "minimal", | ||
| "low", | ||
| "medium", | ||
| "high", | ||
| "xhigh", | ||
| "max", | ||
| ], | ||
| }, | ||
| { | ||
| ...modelOptions[1], | ||
| reasoningEffortDefault: "low", | ||
| reasoningEfforts: ["low", "medium"], | ||
| }, | ||
| ] as const; | ||
|
|
||
| export const SubmitsReasoningEffort: Story = { | ||
|
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. Note [CRF-10] No story tests submitting without moving the slider (the model default should flow through). The gap is narrow:
Contributor
Author
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. Not changing this: default fallback is already covered by focused
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. Acknowledged. Existing coverage is sufficient.
|
||
| args: { | ||
| ...defaultArgs, | ||
| onCreateChat: fn().mockResolvedValue(undefined), | ||
| modelOptions: [...effortModelOptions], | ||
| }, | ||
| play: async ({ canvasElement, args }) => { | ||
| const canvas = within(canvasElement); | ||
| const body = within(canvasElement.ownerDocument.body); | ||
|
|
||
| // Open the model selector; the effort row shows the model default. | ||
| await userEvent.click(canvas.getByRole("combobox", { name: "GPT-4o" })); | ||
| const slider = await body.findByRole("slider"); | ||
| // "medium" is the fourth of seven selectable efforts. | ||
| expect(slider).toHaveAttribute("aria-valuenow", "3"); | ||
|
|
||
| // Bump the effort to "high" with the keyboard, then close. | ||
| await userEvent.tab(); | ||
| expect(slider).toHaveFocus(); | ||
| await userEvent.keyboard("{ArrowRight}"); | ||
| await waitFor(() => { | ||
| expect(slider).toHaveAttribute("aria-valuenow", "4"); | ||
| }); | ||
| await userEvent.keyboard("{Escape}"); | ||
|
|
||
| await submitMessage(canvasElement, "create with reasoning effort"); | ||
| await waitFor(() => { | ||
| expect(args.onCreateChat).toHaveBeenCalled(); | ||
| }); | ||
| const options = getCreateOptions(args.onCreateChat); | ||
| expect(options.model).toBe(modelConfigID); | ||
| expect(options.reasoningEffort).toBe("high"); | ||
| }, | ||
| }; | ||
|
|
||
| const mockWorkspaces = [ | ||
| { | ||
| ...MockWorkspace, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.