Skip to content

Commit

Permalink
fix: conditional render model setting based on selected model (#4300)
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur authored Dec 19, 2024
1 parent a1ea94a commit c7a5cb5
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions web/screens/Thread/ThreadRightPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,34 +268,38 @@ const ThreadRightPanel = () => {
<div className="flex flex-col gap-4 px-2 py-4">
<ModelDropdown />
</div>
<Accordion defaultValue={[]}>
{settings.runtimeSettings.length !== 0 && (
<AccordionItem
title={INFERENCE_SETTINGS}
value={INFERENCE_SETTINGS}
>
<ModelSetting
componentProps={settings.runtimeSettings}
onValueChanged={onValueChanged}
/>
</AccordionItem>
)}

{promptTemplateSettings.length !== 0 && (
<AccordionItem title={MODEL_SETTINGS} value={MODEL_SETTINGS}>
<PromptTemplateSetting componentData={promptTemplateSettings} />
</AccordionItem>
)}

{settings.engineSettings.length !== 0 && (
<AccordionItem title={ENGINE_SETTINGS} value={ENGINE_SETTINGS}>
<EngineSetting
componentData={settings.engineSettings}
onValueChanged={onValueChanged}
/>
</AccordionItem>
)}
</Accordion>
{selectedModel && (
<Accordion defaultValue={[]}>
{settings.runtimeSettings.length !== 0 && (
<AccordionItem
title={INFERENCE_SETTINGS}
value={INFERENCE_SETTINGS}
>
<ModelSetting
componentProps={settings.runtimeSettings}
onValueChanged={onValueChanged}
/>
</AccordionItem>
)}

{promptTemplateSettings.length !== 0 && (
<AccordionItem title={MODEL_SETTINGS} value={MODEL_SETTINGS}>
<PromptTemplateSetting
componentData={promptTemplateSettings}
/>
</AccordionItem>
)}

{settings.engineSettings.length !== 0 && (
<AccordionItem title={ENGINE_SETTINGS} value={ENGINE_SETTINGS}>
<EngineSetting
componentData={settings.engineSettings}
onValueChanged={onValueChanged}
/>
</AccordionItem>
)}
</Accordion>
)}
</TabsContent>
<TabsContent value="tools">
<Tools />
Expand Down

0 comments on commit c7a5cb5

Please sign in to comment.