fix: conditional render model setting based on selected model #4300
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
The changes in the
ThreadRightPanel/index.tsx
file involve wrapping anAccordion
component and its children with an additional conditional check to ensure that aselectedModel
exists before rendering theAccordion
and itsAccordionItem
children. Here's a summary of the modifications:Conditional Rendering: Previously, the
Accordion
component and itsAccordionItem
components were rendered unconditionally. Now, they are only rendered ifselectedModel
is truthy.No Changes to Styling or Structure: There are no changes to the styling (
className
) or the internal structure of theAccordion
andAccordionItem
components.Preservation of Existing Logic: The logic inside
AccordionItem
s remains intact, including checks on the length ofsettings.runtimeSettings
,promptTemplateSettings
, andsettings.engineSettings
, as well as the handling ofonValueChanged
callbacks.This change likely introduces a dependency on the
selectedModel
variable, ensuring that the settings sections are conditionally displayed only when a model is selected or defined.Fixes Issues
Self Checklist