Skip to content

Commit

Permalink
conditional copy button save, if have engine params changes value but…
Browse files Browse the repository at this point in the history
…ton should be save & reload
  • Loading branch information
urmauur committed Jan 4, 2024
1 parent bf9cd44 commit 0f333c3
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions web/screens/Chat/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ const Sidebar: React.FC = () => {
return changedFieldValues
}

const isEngineParamsChanges = componentDataEngineSetting.some((x) =>
Object.keys(form.formState.dirtyFields).includes(x.name)
)

const onSubmit = async (values: any) => {
if (!threadId) return
if (!activeThread) return
Expand Down Expand Up @@ -334,19 +338,19 @@ const Sidebar: React.FC = () => {
</div>
{/* Temporary disabled */}
{/* <div>
<label
id="tool-title"
className="mb-2 inline-block font-bold text-zinc-500 dark:text-gray-300"
>
Tools
</label>
<div className="flex items-center justify-between">
<label className="font-medium text-zinc-500 dark:text-gray-300">
Retrieval
<label
id="tool-title"
className="mb-2 inline-block font-bold text-zinc-500 dark:text-gray-300"
>
Tools
</label>
<Switch name="retrieval" />
</div>
</div> */}
<div className="flex items-center justify-between">
<label className="font-medium text-zinc-500 dark:text-gray-300">
Retrieval
</label>
<Switch name="retrieval" />
</div>
</div> */}
</div>
</CardSidebar>
<CardSidebar
Expand Down Expand Up @@ -401,7 +405,7 @@ const Sidebar: React.FC = () => {
<Tooltip open={currentPrompt.length !== 0}>
<TooltipTrigger asChild>
<Button type="submit" block>
Save
{isEngineParamsChanges ? 'Save & Reload' : 'Save'}
</Button>
</TooltipTrigger>
<TooltipPortal>
Expand Down

0 comments on commit 0f333c3

Please sign in to comment.