-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add engine settings (janhq#1199)
* feat: add engine settings Signed-off-by: James <[email protected]> --------- Signed-off-by: James <[email protected]> Co-authored-by: Louis <[email protected]>
- Loading branch information
Showing
17 changed files
with
442 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Textarea } from '@janhq/uikit' | ||
|
||
import { useAtomValue } from 'jotai' | ||
|
||
import useUpdateModelParameters from '@/hooks/useUpdateModelParameters' | ||
|
||
import { getActiveThreadIdAtom } from '@/helpers/atoms/Thread.atom' | ||
|
||
type Props = { | ||
title: string | ||
name: string | ||
placeholder: string | ||
value: string | ||
} | ||
|
||
const ModelConfigInput: React.FC<Props> = ({ | ||
title, | ||
name, | ||
value, | ||
placeholder, | ||
}) => { | ||
const { updateModelParameter } = useUpdateModelParameters() | ||
const threadId = useAtomValue(getActiveThreadIdAtom) | ||
|
||
const onValueChanged = (e: React.ChangeEvent<HTMLTextAreaElement>) => { | ||
if (!threadId) return | ||
|
||
updateModelParameter(threadId, name, e.target.value) | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col"> | ||
<p className="mb-2 text-sm font-semibold text-gray-600">{title}</p> | ||
<Textarea | ||
placeholder={placeholder} | ||
onChange={onValueChanged} | ||
value={value} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export default ModelConfigInput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.