fix: app picks model automatically edge cases #4322
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe Your Changes
Fixed an issue where deleted models were not handled gracefully. However, there are still edge cases where users could change tool settings or delete a new thread, causing the app to automatically assign a new model to older threads with deleted models.
Fixes Issues
Changes made
This pull request includes several changes to improve the handling of model selection and thread management in the web application. The most important changes include refactoring the code to simplify model selection and updating the thread deletion logic to use a new hook.
Improvements to model selection:
web/containers/ModelDropdown/index.tsx
: Simplified the logic for finding and setting the selected model by removing unnecessary conditional checks.web/screens/Thread/ThreadRightPanel/Tools/index.tsx
: Refactored the model selection logic to directly set the selected model without additional checks.Enhancements to thread management:
web/hooks/useDeleteThread.ts
: AddeduseSetActiveThread
hook to manage the active thread state and updated thecleanThread
function to use this new hook. [1] [2] [3]