fix: broken jan build - add log trace (jan.log) (#3336)
This commit is contained in:
parent
6e4b6b09ae
commit
77422c3a7e
@ -18,7 +18,7 @@ import { handleAppIPCs } from './handlers/native'
|
||||
* Utils
|
||||
**/
|
||||
import { setupMenu } from './utils/menu'
|
||||
import { createUserSpace, getAppConfigurations } from './utils/path'
|
||||
import { createUserSpace, getJanDataFolderPath } from './utils/path'
|
||||
import { migrate } from './utils/migration'
|
||||
import { cleanUpAndQuit } from './utils/clean'
|
||||
import { setupCore } from './utils/setup'
|
||||
@ -34,8 +34,6 @@ const mainPath = join(rendererPath, 'index.html')
|
||||
|
||||
const mainUrl = 'http://localhost:3000'
|
||||
|
||||
import { dependencies } from './package.json'
|
||||
|
||||
const gotTheLock = app.requestSingleInstanceLock()
|
||||
|
||||
if (process.defaultApp) {
|
||||
@ -65,7 +63,11 @@ const host = '127.0.0.1'
|
||||
|
||||
app
|
||||
.whenReady()
|
||||
.then(() => setupCore(dependencies['cortexso'] ?? 'Not found'))
|
||||
.then(() => {
|
||||
const dataFolderPath = join(getJanDataFolderPath(), 'jan.log')
|
||||
log.transports.file.resolvePathFn = () => dataFolderPath
|
||||
})
|
||||
.then(() => setupCore())
|
||||
.then(() => {
|
||||
if (!gotTheLock) {
|
||||
app.quit()
|
||||
@ -87,13 +89,11 @@ app
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
.then(() => killProcessesOnPort(cortexCppPort))
|
||||
.then(() => killProcessesOnPort(cortexJsPort))
|
||||
.then(() => {
|
||||
const appConfiguration = getAppConfigurations()
|
||||
const janDataFolder = appConfiguration.dataFolderPath
|
||||
|
||||
start('jan', host, cortexJsPort, cortexCppPort, janDataFolder)
|
||||
start('jan', host, cortexJsPort, cortexCppPort, getJanDataFolderPath())
|
||||
})
|
||||
.then(createUserSpace)
|
||||
.then(migrate)
|
||||
|
||||
@ -35,7 +35,8 @@
|
||||
"docs",
|
||||
"scripts",
|
||||
"icons",
|
||||
"themes"
|
||||
"themes",
|
||||
"package.json"
|
||||
],
|
||||
"publish": [
|
||||
{
|
||||
|
||||
@ -1,16 +1,26 @@
|
||||
import { app } from 'electron'
|
||||
import Store from 'electron-store'
|
||||
import { existsSync, readFileSync } from 'original-fs'
|
||||
import { appResourcePath } from './path'
|
||||
import { join } from 'path'
|
||||
const DEFAULT_WIDTH = 1000
|
||||
const DEFAULT_HEIGHT = 800
|
||||
|
||||
const storage = new Store()
|
||||
|
||||
export const setupCore = async (cortexsoVersion: string) => {
|
||||
export const setupCore = async () => {
|
||||
let cortexVersion = 'N/A'
|
||||
// Read package.json
|
||||
const pkgPath = join(await appResourcePath(), 'package.json')
|
||||
if(existsSync(pkgPath)) {
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
|
||||
cortexVersion = pkg.dependencies['cortexso']
|
||||
}
|
||||
// Setup core api for main process
|
||||
global.core = {
|
||||
// Define appPath function for app to retrieve app path globally
|
||||
appPath: () => app.getPath('userData'),
|
||||
cortexVersion: () => cortexsoVersion,
|
||||
cortexVersion: () => cortexVersion,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { useCallback } from 'react'
|
||||
|
||||
import { Assistant } from '@janhq/core'
|
||||
import log from 'electron-log/renderer'
|
||||
|
||||
import { useSetAtom } from 'jotai'
|
||||
|
||||
@ -49,7 +48,6 @@ const useThreads = () => {
|
||||
assistant.instructions = instructions
|
||||
}
|
||||
const thread = await createThread(assistant)
|
||||
log.info('Create new thread result', thread)
|
||||
setThreads((threads) => [thread, ...threads])
|
||||
setActiveThread(thread.id)
|
||||
return thread
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user