-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: prevent IO Intelligence model picker from reverting selection #7993
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 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -126,13 +126,14 @@ export const ModelPicker = ({ | |||||||||||
| }, []) | ||||||||||||
|
|
||||||||||||
| useEffect(() => { | ||||||||||||
| if (!selectedModelId && !isInitialized.current) { | ||||||||||||
| const initialValue = modelIds.includes(selectedModelId) ? selectedModelId : defaultModelId | ||||||||||||
| // Only initialize if the field has never been set (undefined), not when it's an empty string | ||||||||||||
| if (apiConfiguration[modelIdKey] === undefined && !isInitialized.current) { | ||||||||||||
| const initialValue = defaultModelId | ||||||||||||
|
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. I see we're removing the model validation logic here. The original code checked
Suggested change
|
||||||||||||
| setApiConfigurationField(modelIdKey, initialValue, false) // false = automatic initialization | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| isInitialized.current = true | ||||||||||||
| }, [modelIds, setApiConfigurationField, modelIdKey, selectedModelId, defaultModelId]) | ||||||||||||
| }, [modelIds, setApiConfigurationField, modelIdKey, apiConfiguration, defaultModelId]) | ||||||||||||
|
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. By changing the dependency from
Suggested change
|
||||||||||||
|
|
||||||||||||
| // Cleanup timeouts on unmount to prevent test flakiness | ||||||||||||
| useEffect(() => { | ||||||||||||
|
|
||||||||||||
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.
This comment could be more specific about why this distinction matters. Consider adding context about the IO Intelligence provider issue: