fix: onboarding should cover cortex models - debounce reduce model reload - rename cortex binary name
This commit is contained in:
parent
2d80d6962b
commit
03333cc4c2
@ -320,6 +320,7 @@ jobs:
|
||||
# TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}'
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: electron/playwright-report/
|
||||
|
||||
@ -49,7 +49,7 @@ describe('test executable cortex file', () => {
|
||||
enginePath: expect.stringContaining(`mac-arm64`),
|
||||
executablePath:
|
||||
originalPlatform === 'darwin'
|
||||
? expect.stringContaining(`/cortex`)
|
||||
? expect.stringContaining(`/cortex-server`)
|
||||
: expect.anything(),
|
||||
cudaVisibleDevices: '',
|
||||
vkVisibleDevices: '',
|
||||
@ -63,7 +63,7 @@ describe('test executable cortex file', () => {
|
||||
enginePath: expect.stringContaining(`mac-x64`),
|
||||
executablePath:
|
||||
originalPlatform === 'darwin'
|
||||
? expect.stringContaining(`/cortex`)
|
||||
? expect.stringContaining(`/cortex-server`)
|
||||
: expect.anything(),
|
||||
cudaVisibleDevices: '',
|
||||
vkVisibleDevices: '',
|
||||
@ -82,7 +82,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`win`),
|
||||
executablePath: expect.stringContaining(`/cortex.exe`),
|
||||
executablePath: expect.stringContaining(`/cortex-server.exe`),
|
||||
cudaVisibleDevices: '',
|
||||
vkVisibleDevices: '',
|
||||
})
|
||||
@ -116,7 +116,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`win-cuda-11-7`),
|
||||
executablePath: expect.stringContaining(`/cortex.exe`),
|
||||
executablePath: expect.stringContaining(`/cortex-server.exe`),
|
||||
cudaVisibleDevices: '0',
|
||||
vkVisibleDevices: '0',
|
||||
})
|
||||
@ -150,7 +150,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`win-cuda-12-0`),
|
||||
executablePath: expect.stringContaining(`/cortex.exe`),
|
||||
executablePath: expect.stringContaining(`/cortex-server.exe`),
|
||||
cudaVisibleDevices: '0',
|
||||
vkVisibleDevices: '0',
|
||||
})
|
||||
@ -168,7 +168,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`linux`),
|
||||
executablePath: expect.stringContaining(`/cortex`),
|
||||
executablePath: expect.stringContaining(`/cortex-server`),
|
||||
cudaVisibleDevices: '',
|
||||
vkVisibleDevices: '',
|
||||
})
|
||||
@ -202,7 +202,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`linux-cuda-11-7`),
|
||||
executablePath: expect.stringContaining(`/cortex`),
|
||||
executablePath: expect.stringContaining(`/cortex-server`),
|
||||
cudaVisibleDevices: '0',
|
||||
vkVisibleDevices: '0',
|
||||
})
|
||||
@ -236,7 +236,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`linux-cuda-12-0`),
|
||||
executablePath: expect.stringContaining(`/cortex`),
|
||||
executablePath: expect.stringContaining(`/cortex-server`),
|
||||
cudaVisibleDevices: '0',
|
||||
vkVisibleDevices: '0',
|
||||
})
|
||||
@ -260,7 +260,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`linux-${instruction}`),
|
||||
executablePath: expect.stringContaining(`/cortex`),
|
||||
executablePath: expect.stringContaining(`/cortex-server`),
|
||||
|
||||
cudaVisibleDevices: '',
|
||||
vkVisibleDevices: '',
|
||||
@ -283,7 +283,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`win-${instruction}`),
|
||||
executablePath: expect.stringContaining(`/cortex.exe`),
|
||||
executablePath: expect.stringContaining(`/cortex-server.exe`),
|
||||
cudaVisibleDevices: '',
|
||||
vkVisibleDevices: '',
|
||||
})
|
||||
@ -322,7 +322,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`win-cuda-12-0`),
|
||||
executablePath: expect.stringContaining(`/cortex.exe`),
|
||||
executablePath: expect.stringContaining(`/cortex-server.exe`),
|
||||
cudaVisibleDevices: '0',
|
||||
vkVisibleDevices: '0',
|
||||
})
|
||||
@ -361,7 +361,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`linux-cuda-12-0`),
|
||||
executablePath: expect.stringContaining(`/cortex`),
|
||||
executablePath: expect.stringContaining(`/cortex-server`),
|
||||
cudaVisibleDevices: '0',
|
||||
vkVisibleDevices: '0',
|
||||
})
|
||||
@ -401,7 +401,7 @@ describe('test executable cortex file', () => {
|
||||
expect(executableCortexFile(settings)).toEqual(
|
||||
expect.objectContaining({
|
||||
enginePath: expect.stringContaining(`linux-vulkan`),
|
||||
executablePath: expect.stringContaining(`/cortex`),
|
||||
executablePath: expect.stringContaining(`/cortex-server`),
|
||||
cudaVisibleDevices: '0',
|
||||
vkVisibleDevices: '0',
|
||||
})
|
||||
@ -429,7 +429,7 @@ describe('test executable cortex file', () => {
|
||||
enginePath: expect.stringContaining(`mac-x64`),
|
||||
executablePath:
|
||||
originalPlatform === 'darwin'
|
||||
? expect.stringContaining(`/cortex`)
|
||||
? expect.stringContaining(`/cortex-server`)
|
||||
: expect.anything(),
|
||||
cudaVisibleDevices: '',
|
||||
vkVisibleDevices: '',
|
||||
|
||||
@ -99,7 +99,7 @@ export const executableCortexFile = (
|
||||
.join('-')
|
||||
let cudaVisibleDevices = gpuSetting?.gpus_in_use.join(',') ?? ''
|
||||
let vkVisibleDevices = gpuSetting?.gpus_in_use.join(',') ?? ''
|
||||
let binaryName = `cortex${extension()}`
|
||||
let binaryName = `cortex-server${extension()}`
|
||||
|
||||
return {
|
||||
enginePath: path.join(__dirname, '..', 'bin', engineFolder),
|
||||
|
||||
@ -11,6 +11,8 @@ import {
|
||||
|
||||
import { useSetAtom } from 'jotai'
|
||||
|
||||
import { useDebouncedCallback } from 'use-debounce'
|
||||
|
||||
import { isLocalEngine } from '@/utils/modelEngine'
|
||||
|
||||
import { extensionManager } from '@/extension'
|
||||
@ -53,17 +55,19 @@ const useModels = () => {
|
||||
Promise.all([getDownloadedModels(), getExtensionModels()])
|
||||
}, [setDownloadedModels, setExtensionModels])
|
||||
|
||||
const reloadData = useDebouncedCallback(() => getData(), 300)
|
||||
|
||||
useEffect(() => {
|
||||
// Try get data on mount
|
||||
getData()
|
||||
reloadData()
|
||||
|
||||
// Listen for model updates
|
||||
events.on(ModelEvent.OnModelsUpdate, async () => getData())
|
||||
events.on(ModelEvent.OnModelsUpdate, async () => reloadData())
|
||||
return () => {
|
||||
// Remove listener on unmount
|
||||
events.off(ModelEvent.OnModelsUpdate, async () => {})
|
||||
}
|
||||
}, [getData])
|
||||
}, [reloadData])
|
||||
}
|
||||
|
||||
const getModels = async (): Promise<Model[]> =>
|
||||
|
||||
@ -8,6 +8,8 @@ import LogoMark from '@/containers/Brand/Logo/Mark'
|
||||
|
||||
import { MainViewState } from '@/constants/screens'
|
||||
|
||||
import { isLocalEngine } from '@/utils/modelEngine'
|
||||
|
||||
import { mainViewStateAtom } from '@/helpers/atoms/App.atom'
|
||||
import { downloadedModelsAtom } from '@/helpers/atoms/Model.atom'
|
||||
|
||||
@ -15,8 +17,7 @@ const EmptyThread = () => {
|
||||
const downloadedModels = useAtomValue(downloadedModelsAtom)
|
||||
const setMainViewState = useSetAtom(mainViewStateAtom)
|
||||
const showOnboardingStep =
|
||||
downloadedModels.filter((e) => e.engine === InferenceEngine.nitro)
|
||||
.length === 0
|
||||
downloadedModels.filter((e) => isLocalEngine(e.engine)).length === 0
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex h-full flex-col items-center justify-center text-center">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user