jan/web/screens/HubScreen2/components/WarningMultipleModelModal.tsx
NamH ec9b5bf682
fix: update new api from cortex to support 0.5.0 (#3221)
* fix: update new api from cortex to support 0.5.0

Signed-off-by: James <namnh0122@gmail.com>

* fix stop button for streaming

Signed-off-by: James <namnh0122@gmail.com>

* fix stop inference for nonstreaming

Signed-off-by: James <namnh0122@gmail.com>

* chore: remove umami prevent tracking call to vercel

Signed-off-by: James <namnh0122@gmail.com>

* add warning modal when running more than 2 model concurrently

Signed-off-by: James <namnh0122@gmail.com>

* fix: skip summarize if abort

Signed-off-by: James <namnh0122@gmail.com>

* 0.5.0-3

* add inference error popup

Signed-off-by: James <namnh0122@gmail.com>

* add back import local model

Signed-off-by: James <namnh0122@gmail.com>

* fix: max token issue (#3225)

Signed-off-by: James <namnh0122@gmail.com>

* format status

Signed-off-by: James <namnh0122@gmail.com>

* fix migration missing instructions

Signed-off-by: James <namnh0122@gmail.com>

* fix: wait for cortex process overlay should be on top (#3224)

* fix: wait for cortex process overlay should be on top

* chore: update cortex.js

* Cortex 0.5.0-5

* add import model to my model screen

Signed-off-by: James <namnh0122@gmail.com>

* fix: should migrate symlink models (#3226)

* fix import on windows (#3229)

Signed-off-by: James <namnh0122@gmail.com>

* fix yarn lint

Signed-off-by: James <namnh0122@gmail.com>

* fix: clean up port before start jan (#3232)

Signed-off-by: James <namnh0122@gmail.com>

---------

Signed-off-by: James <namnh0122@gmail.com>
Co-authored-by: Van Pham <64197333+Van-QA@users.noreply.github.com>
Co-authored-by: Louis <louis@jan.ai>
2024-08-02 09:37:04 +07:00

50 lines
1.4 KiB
TypeScript

import { Fragment, useCallback, useMemo } from 'react'
import { Button, Modal, ModalClose } from '@janhq/joi'
import { atom, useAtom, useAtomValue } from 'jotai'
import { activeModelsAtom } from '@/helpers/atoms/Model.atom'
export const showWarningMultipleModelModalAtom = atom<boolean>(false)
const WarningMultipleModelModal: React.FC = () => {
const [showWarningMultipleModelModal, setShowWarningMultipleModelModal] =
useAtom(showWarningMultipleModelModalAtom)
const activeModels = useAtomValue(activeModelsAtom)
const onClose = useCallback(() => {
setShowWarningMultipleModelModal(false)
}, [setShowWarningMultipleModelModal])
const title = useMemo(
() => `${activeModels.length} models running`,
[activeModels]
)
return (
<Modal
hideClose
open={showWarningMultipleModelModal}
onOpenChange={onClose}
title={title}
content={
<Fragment>
<p className="text-[hsla(var(--text-secondary))]">
This may affect performance. Please review them via System Monitor
in the lower right conner of Jan app.
</p>
<div className="mt-4 flex justify-end">
<ModalClose asChild>
<Button onClick={onClose} autoFocus theme="destructive">
OK
</Button>
</ModalClose>
</div>
</Fragment>
}
/>
)
}
export default WarningMultipleModelModal