fix: enable extensions migration (#3442)

This commit is contained in:
Louis 2024-08-22 19:11:38 +07:00 committed by GitHub
parent aaeb18cd59
commit cf07465cad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View File

@ -11,7 +11,11 @@ import {
lstatSync,
} from 'fs'
import Store from 'electron-store'
import { getJanDataFolderPath, appResourcePath } from '@janhq/core/node'
import {
getJanDataFolderPath,
appResourcePath,
getJanExtensionsPath,
} from '@janhq/core/node'
/**
* Migrates the extensions & themes.
@ -24,8 +28,9 @@ export async function migrate() {
if (store.get('migrated_version') !== app.getVersion()) {
console.debug('start migration:', store.get('migrated_version'))
// if (existsSync(getJanExtensionsPath()))
// rmdirSync(getJanExtensionsPath(), { recursive: true })
if (existsSync(getJanExtensionsPath()))
rmdirSync(getJanExtensionsPath(), { recursive: true })
await migrateThemes()
store.set('migrated_version', app.getVersion())

View File

@ -82,9 +82,9 @@ export default function useUpdateModelParameters() {
const defaultContextLength = settingParams.ctx_len
const defaultMaxTokens = runtimeParams.max_tokens
// eslint-disable-next-line @typescript-eslint/naming-convention
// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
const { ctx_len, ...toSaveSettings } = settingParams
// eslint-disable-next-line @typescript-eslint/naming-convention
// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
const { max_tokens, ...toSaveParams } = runtimeParams
const updatedModel = {
@ -116,6 +116,8 @@ export default function useUpdateModelParameters() {
preserveModelFeatureEnabled,
updateDownloadedModel,
setSelectedModel,
recommendedModel,
setRecommendedModel,
]
)