* fix: turn off experimental settings should also turn off quick ask (#2411) * fix: app glitches 1s generating response before starting model (#2412) * fix: disable experimental feature should also disable vulkan (#2414) * fix: model load stuck on windows when can't get CPU core count (#2413) Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai> * feat: TensorRT-LLM engine update support (#2415) * fix: engine update * chore: add remove prepopulated models Signed-off-by: James <james@jan.ai> * update tinyjensen url Signed-off-by: James <james@jan.ai> * update llamacorn Signed-off-by: James <james@jan.ai> * update Mistral 7B Instruct v0.1 int4 Signed-off-by: James <james@jan.ai> * update tensorrt Signed-off-by: James <james@jan.ai> * update Signed-off-by: hiro <hiro@jan.ai> * update Signed-off-by: James <james@jan.ai> * prettier Signed-off-by: James <james@jan.ai> * update mistral config Signed-off-by: James <james@jan.ai> * fix some lint Signed-off-by: James <james@jan.ai> --------- Signed-off-by: James <james@jan.ai> Signed-off-by: hiro <hiro@jan.ai> Co-authored-by: James <james@jan.ai> Co-authored-by: hiro <hiro@jan.ai> * Tensorrt LLM disable turing support (#2418) Co-authored-by: Hien To <tominhhien97@gmail.com> * chore: add prompt template tensorrtllm (#2375) * chore: add prompt template tensorrtllm * Add Prompt template for mistral and correct model metadata --------- Co-authored-by: Hien To <tominhhien97@gmail.com> * fix: correct tensorrt mistral model.json (#2419) --------- Signed-off-by: James <james@jan.ai> Signed-off-by: hiro <hiro@jan.ai> Co-authored-by: Louis <louis@jan.ai> Co-authored-by: James <james@jan.ai> Co-authored-by: hiro <hiro@jan.ai> Co-authored-by: hiento09 <136591877+hiento09@users.noreply.github.com> Co-authored-by: Hien To <tominhhien97@gmail.com>
105 lines
2.6 KiB
TypeScript
105 lines
2.6 KiB
TypeScript
'use client'
|
|
|
|
import { PropsWithChildren, useCallback, useEffect, useState } from 'react'
|
|
|
|
import { Toaster } from 'react-hot-toast'
|
|
|
|
import { usePathname } from 'next/navigation'
|
|
|
|
import { TooltipProvider } from '@janhq/uikit'
|
|
|
|
import GPUDriverPrompt from '@/containers/GPUDriverPromptModal'
|
|
import EventListenerWrapper from '@/containers/Providers/EventListener'
|
|
import JotaiWrapper from '@/containers/Providers/Jotai'
|
|
import ThemeWrapper from '@/containers/Providers/Theme'
|
|
|
|
import { setupCoreServices } from '@/services/coreService'
|
|
import {
|
|
isCoreExtensionInstalled,
|
|
setupBaseExtensions,
|
|
} from '@/services/extensionService'
|
|
|
|
import Umami from '@/utils/umami'
|
|
|
|
import Loader from '../Loader'
|
|
|
|
import DataLoader from './DataLoader'
|
|
|
|
import KeyListener from './KeyListener'
|
|
|
|
import { extensionManager } from '@/extension'
|
|
|
|
const Providers = (props: PropsWithChildren) => {
|
|
const { children } = props
|
|
const pathname = usePathname()
|
|
|
|
const [setupCore, setSetupCore] = useState(false)
|
|
const [activated, setActivated] = useState(false)
|
|
const [settingUp, setSettingUp] = useState(false)
|
|
|
|
const setupExtensions = useCallback(async () => {
|
|
// Register all active extensions
|
|
await extensionManager.registerActive()
|
|
|
|
setTimeout(async () => {
|
|
if (!isCoreExtensionInstalled()) {
|
|
// TODO: Proper window handle
|
|
// Do not migrate extension from quick ask window
|
|
if (pathname === '/search') {
|
|
return
|
|
}
|
|
setSettingUp(true)
|
|
await setupBaseExtensions()
|
|
return
|
|
}
|
|
|
|
extensionManager.load()
|
|
setSettingUp(false)
|
|
setActivated(true)
|
|
}, 500)
|
|
}, [pathname])
|
|
|
|
// Services Setup
|
|
useEffect(() => {
|
|
setupCoreServices()
|
|
setSetupCore(true)
|
|
return () => {
|
|
extensionManager.unload()
|
|
}
|
|
}, [])
|
|
|
|
useEffect(() => {
|
|
if (setupCore) {
|
|
// Electron
|
|
if (window && window.core?.api) {
|
|
setupExtensions()
|
|
} else {
|
|
// Host
|
|
setActivated(true)
|
|
}
|
|
}
|
|
}, [setupCore, setupExtensions])
|
|
|
|
return (
|
|
<JotaiWrapper>
|
|
<ThemeWrapper>
|
|
<Umami />
|
|
{settingUp && <Loader description="Preparing Update..." />}
|
|
{setupCore && activated && (
|
|
<KeyListener>
|
|
<EventListenerWrapper>
|
|
<TooltipProvider delayDuration={0}>
|
|
<DataLoader>{children}</DataLoader>
|
|
</TooltipProvider>
|
|
{!isMac && <GPUDriverPrompt />}
|
|
</EventListenerWrapper>
|
|
<Toaster />
|
|
</KeyListener>
|
|
)}
|
|
</ThemeWrapper>
|
|
</JotaiWrapper>
|
|
)
|
|
}
|
|
|
|
export default Providers
|