Skip to content

Commit

Permalink
fix: conditional render model setting based on selected model
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur committed Dec 19, 2024
1 parent 0271774 commit c28770b
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 c28770b

Please sign in to comment.