diff --git a/electron/handlers/native.ts b/electron/handlers/native.ts index ee199fd76f..2d7226c52f 100644 --- a/electron/handlers/native.ts +++ b/electron/handlers/native.ts @@ -231,7 +231,10 @@ export function handleAppIPCs() { const destinationFolderPath = join(configration.data_folder, 'models') if (!existsSync(destinationFolderPath)) mkdirSync(destinationFolderPath) - console.log('destinationFolderPath', destinationFolderPath) + + console.log( + `Syncing model from ${allModelFolders} to ${destinationFolderPath}` + ) const reflect = require('@alumna/reflect') for (const modelName of allModelFolders) { @@ -305,7 +308,6 @@ export function handleAppIPCs() { src: modelFolderPath, dest: destinationPath, recursive: true, - exclude: ['model.json'], delete: false, overwrite: true, errorOnExist: false, diff --git a/electron/main.ts b/electron/main.ts index 455e837f80..6ff9cf0d95 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -64,6 +64,7 @@ const host = '127.0.0.1' app .whenReady() + .then(setupCore) .then(() => { if (!gotTheLock) { app.quit() @@ -119,7 +120,6 @@ app log.info(`stdout: ${stdout}`) }) }) - .then(setupCore) .then(createUserSpace) .then(migrate) .then(setupMenu) diff --git a/electron/utils/path.ts b/electron/utils/path.ts index 1c230299f6..a6ff9d4755 100644 --- a/electron/utils/path.ts +++ b/electron/utils/path.ts @@ -4,7 +4,6 @@ import { join } from 'path' import { AppConfiguration } from '@janhq/core/node' import os from 'os' - const configurationFileName = 'settings.json' const defaultJanDataFolder = join(os.homedir(), 'jan') @@ -60,6 +59,7 @@ export const getAppConfigurations = (): AppConfiguration => { // Retrieve Application Support folder path // Fallback to user home directory if not found const configurationFile = getConfigurationFilePath() + console.debug('getAppConfiguration file path', configurationFile) if (!existsSync(configurationFile)) { // create default app config if we don't have one @@ -74,6 +74,7 @@ export const getAppConfigurations = (): AppConfiguration => { const appConfigurations: AppConfiguration = JSON.parse( readFileSync(configurationFile, 'utf-8') ) + console.debug('app config', JSON.stringify(appConfigurations)) return appConfigurations } catch (err) { console.error( @@ -86,7 +87,7 @@ export const getAppConfigurations = (): AppConfiguration => { const getConfigurationFilePath = () => join( global.core?.appPath() || - process.env[process.platform == 'win32' ? 'USERPROFILE' : 'HOME'], + process.env[process.platform == 'win32' ? 'USERPROFILE' : 'HOME'], configurationFileName ) diff --git a/web/containers/Providers/ModalMigrations.tsx b/web/containers/Providers/ModalMigrations.tsx index 604594825d..6f3cc6abc1 100644 --- a/web/containers/Providers/ModalMigrations.tsx +++ b/web/containers/Providers/ModalMigrations.tsx @@ -11,6 +11,8 @@ import Spinner from '@/containers/Loader/Spinner' import useMigratingData from '@/hooks/useMigratingData' +import useModels from '@/hooks/useModels' + import { didShowMigrationWarningAtom } from '@/helpers/atoms/AppConfig.atom' export const showMigrationModalAtom = atom<boolean>(false) @@ -29,6 +31,7 @@ const ModalMigrations = () => { useState<MigrationState>('idle') const [modelMigrationState, setModelMigrationState] = useState<MigrationState>('idle') + const { getModels } = useModels() const getStepTitle = () => { switch (step) { @@ -71,7 +74,8 @@ const ModalMigrations = () => { setStep(2) await migratingModels() await migrationThreadsAndMessages() - }, [migratingModels, migrationThreadsAndMessages]) + getModels() + }, [migratingModels, migrationThreadsAndMessages, getModels]) const onDismiss = useCallback(() => { setStep(1) diff --git a/web/screens/Settings/Advanced/components/DataMigration.tsx b/web/screens/Settings/Advanced/components/DataMigration.tsx index 3e41c9e584..6245030214 100644 --- a/web/screens/Settings/Advanced/components/DataMigration.tsx +++ b/web/screens/Settings/Advanced/components/DataMigration.tsx @@ -43,10 +43,13 @@ const DataMigration: React.FC = () => { <div className="flex w-full flex-col items-start justify-between gap-4 border-b border-[hsla(var(--app-border))] py-4 first:pt-0 last:border-none sm:flex-row"> <div className="flex-shrink-0 space-y-1"> <div className="flex gap-x-2"> - <h6 className="font-semibold capitalize">Clear logs</h6> + <h6 className="font-semibold capitalize"> + Migrate data from old version of Jan app + </h6> </div> <p className="font-medium leading-relaxed text-[hsla(var(--text-secondary))]"> - Clear all logs from Jan app. + Migrate multiple times can cause duplicate threads, please consider + using the remove threads button to clean up existing threads data </p> </div> <div className="flex flex-row gap-x-2">