Merge branch 'main' into docs/add-guides

This commit is contained in:
0xSage 2024-01-05 13:45:48 +08:00 committed by GitHub
commit 565e690352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 38 deletions

View File

@ -64,7 +64,7 @@ Jan is a startup with an open source business model. We believe in the need for
We use Github to build in public, and welcome anyone to join in. We use Github to build in public, and welcome anyone to join in.
- [Jan's Kanban](https://github.com/orgs/janhq/projects/5) - [Jan's Kanban](https://github.com/orgs/janhq/projects/5)
- [Jan's Roadmap](https://github.com/orgs/janhq/projects/5/views/2) - [Jan's Roadmap](https://github.com/orgs/janhq/projects/5/views/29)
### Bootstrapped ### Bootstrapped
@ -90,4 +90,4 @@ Drop us a message in our [Discord](https://discord.gg/af6SaTdzpx) and we'll get
Jan has a culture of ownership, independent thought, and lightning fast execution. If you'd like to join us, we have open positions on our [careers page](https://janai.bamboohr.com/careers). Jan has a culture of ownership, independent thought, and lightning fast execution. If you'd like to join us, we have open positions on our [careers page](https://janai.bamboohr.com/careers).
## Footnotes ## Footnotes

View File

@ -72,7 +72,7 @@ export const presetConfiguration: Record<string, SettingComponentData> = {
stream: { stream: {
name: 'stream', name: 'stream',
title: 'Stream', title: 'Stream',
description: 'Stream', description: 'Enable real-time data processing for faster predictions.',
controllerType: 'checkbox', controllerType: 'checkbox',
controllerData: { controllerData: {
checked: false, checked: false,

View File

@ -19,7 +19,7 @@ import DropdownListSidebar, {
import { useCreateNewThread } from '@/hooks/useCreateNewThread' import { useCreateNewThread } from '@/hooks/useCreateNewThread'
import { getConfigurationsData } from '@/utils/componentSettings' import { getConfigurationsData } from '@/utils/componentSettings'
import { toSettingParams } from '@/utils/model_param' import { toRuntimeParams, toSettingParams } from '@/utils/model_param'
import EngineSetting from '../EngineSetting' import EngineSetting from '../EngineSetting'
import ModelSetting from '../ModelSetting' import ModelSetting from '../ModelSetting'
@ -44,7 +44,9 @@ const Sidebar: React.FC = () => {
const threadStates = useAtomValue(threadStatesAtom) const threadStates = useAtomValue(threadStatesAtom)
const modelEngineParams = toSettingParams(activeModelParams) const modelEngineParams = toSettingParams(activeModelParams)
const modelRuntimeParams = toRuntimeParams(activeModelParams)
const componentDataEngineSetting = getConfigurationsData(modelEngineParams) const componentDataEngineSetting = getConfigurationsData(modelEngineParams)
const componentDataRuntimeSetting = getConfigurationsData(modelRuntimeParams)
const onReviewInFinderClick = async (type: string) => { const onReviewInFinderClick = async (type: string) => {
if (!activeThread) return if (!activeThread) return
@ -224,34 +226,42 @@ const Sidebar: React.FC = () => {
<DropdownListSidebar /> <DropdownListSidebar />
</div> </div>
<div className="mt-6"> {componentDataRuntimeSetting.length !== 0 && (
<CardSidebar title="Inference Parameters" asChild> <div className="mt-6">
<div className="px-2 py-4"> <CardSidebar title="Inference Parameters" asChild>
<ModelSetting /> <div className="px-2 py-4">
</div> <ModelSetting />
</CardSidebar> </div>
</div> </CardSidebar>
</div>
)}
<div className="mt-4"> {componentDataEngineSetting.filter(
<CardSidebar title="Model Parameters" asChild> (x) => x.name === 'prompt_template'
<div className="px-2 py-4"> ).length !== 0 && (
{settingComponentBuilder(componentDataEngineSetting, true)} <div className="mt-4">
</div> <CardSidebar title="Model Parameters" asChild>
</CardSidebar> <div className="px-2 py-4">
</div> {settingComponentBuilder(componentDataEngineSetting, true)}
</div>
</CardSidebar>
</div>
)}
<div className="my-4"> {componentDataEngineSetting.length !== 0 && (
<CardSidebar <div className="my-4">
title="Engine Parameters" <CardSidebar
onRevealInFinderClick={onReviewInFinderClick} title="Engine Parameters"
onViewJsonClick={onViewJsonClick} onRevealInFinderClick={onReviewInFinderClick}
asChild onViewJsonClick={onViewJsonClick}
> asChild
<div className="px-2 py-4"> >
<EngineSetting /> <div className="px-2 py-4">
</div> <EngineSetting />
</CardSidebar> </div>
</div> </CardSidebar>
</div>
)}
</div> </div>
</CardSidebar> </CardSidebar>
</div> </div>

View File

@ -5,6 +5,7 @@ import {
ModalTrigger, ModalTrigger,
ModalClose, ModalClose,
ModalFooter, ModalFooter,
ModalPortal,
ModalContent, ModalContent,
ModalHeader, ModalHeader,
ModalTitle, ModalTitle,
@ -89,7 +90,9 @@ export default function ThreadList() {
className={twMerge( className={twMerge(
`group/message relative mb-1 flex cursor-pointer flex-col transition-all hover:rounded-lg hover:bg-gray-100 hover:dark:bg-secondary/50` `group/message relative mb-1 flex cursor-pointer flex-col transition-all hover:rounded-lg hover:bg-gray-100 hover:dark:bg-secondary/50`
)} )}
onClick={() => onThreadClick(thread)} onClick={() => {
onThreadClick(thread)
}}
> >
<div className="relative z-10 p-4 py-4"> <div className="relative z-10 p-4 py-4">
<div className="flex justify-between"> <div className="flex justify-between">
@ -111,7 +114,7 @@ export default function ThreadList() {
<MoreVerticalIcon /> <MoreVerticalIcon />
<div className="invisible absolute right-0 z-20 w-40 overflow-hidden rounded-lg border border-border bg-background shadow-lg group-hover/icon:visible"> <div className="invisible absolute right-0 z-20 w-40 overflow-hidden rounded-lg border border-border bg-background shadow-lg group-hover/icon:visible">
<Modal> <Modal>
<ModalTrigger asChild> <ModalTrigger asChild onClick={(e) => e.stopPropagation()}>
<div className="flex cursor-pointer items-center space-x-2 px-4 py-2 hover:bg-secondary"> <div className="flex cursor-pointer items-center space-x-2 px-4 py-2 hover:bg-secondary">
<Paintbrush <Paintbrush
size={16} size={16}
@ -122,6 +125,7 @@ export default function ThreadList() {
</span> </span>
</div> </div>
</ModalTrigger> </ModalTrigger>
<ModalPortal />
<ModalContent> <ModalContent>
<ModalHeader> <ModalHeader>
<ModalTitle>Clean Thread</ModalTitle> <ModalTitle>Clean Thread</ModalTitle>
@ -129,13 +133,19 @@ export default function ThreadList() {
<p>Are you sure you want to clean this thread?</p> <p>Are you sure you want to clean this thread?</p>
<ModalFooter> <ModalFooter>
<div className="flex gap-x-2"> <div className="flex gap-x-2">
<ModalClose asChild> <ModalClose
asChild
onClick={(e) => e.stopPropagation()}
>
<Button themes="ghost">No</Button> <Button themes="ghost">No</Button>
</ModalClose> </ModalClose>
<ModalClose asChild> <ModalClose asChild>
<Button <Button
themes="danger" themes="danger"
onClick={() => cleanThread(thread.id)} onClick={(e) => {
e.stopPropagation()
cleanThread(thread.id)
}}
autoFocus autoFocus
> >
Yes Yes
@ -145,9 +155,8 @@ export default function ThreadList() {
</ModalFooter> </ModalFooter>
</ModalContent> </ModalContent>
</Modal> </Modal>
<Modal> <Modal>
<ModalTrigger asChild> <ModalTrigger asChild onClick={(e) => e.stopPropagation()}>
<div className="flex cursor-pointer items-center space-x-2 px-4 py-2 hover:bg-secondary"> <div className="flex cursor-pointer items-center space-x-2 px-4 py-2 hover:bg-secondary">
<Trash2Icon <Trash2Icon
size={16} size={16}
@ -158,6 +167,7 @@ export default function ThreadList() {
</span> </span>
</div> </div>
</ModalTrigger> </ModalTrigger>
<ModalPortal />
<ModalContent> <ModalContent>
<ModalHeader> <ModalHeader>
<ModalTitle>Delete Thread</ModalTitle> <ModalTitle>Delete Thread</ModalTitle>
@ -168,14 +178,20 @@ export default function ThreadList() {
</p> </p>
<ModalFooter> <ModalFooter>
<div className="flex gap-x-2"> <div className="flex gap-x-2">
<ModalClose asChild> <ModalClose
asChild
onClick={(e) => e.stopPropagation()}
>
<Button themes="ghost">No</Button> <Button themes="ghost">No</Button>
</ModalClose> </ModalClose>
<ModalClose asChild> <ModalClose asChild>
<Button <Button
autoFocus autoFocus
themes="danger" themes="danger"
onClick={() => deleteThread(thread.id)} onClick={(e) => {
e.stopPropagation()
deleteThread(thread.id)
}}
> >
Yes Yes
</Button> </Button>