mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-05-11 18:09:50 +08:00
change sqlite backend; upgrade electron; fix ipc file cannot listen in macOS
This commit is contained in:
@@ -38,18 +38,9 @@ if (!ipcSocketName) {
|
||||
process.env.GEEKGEEKRUND_PIPE_NAME = `geekgeekrun-d_${randomUUID()}`
|
||||
ipcSocketName = process.env.GEEKGEEKRUND_PIPE_NAME
|
||||
}
|
||||
let ipcSocketPath
|
||||
if (process.platform === 'win32') {
|
||||
ipcSocketPath = `\\\\.\\pipe\\${ipcSocketName}`
|
||||
}
|
||||
else {
|
||||
ipcSocketPath = path.join(tmpdir(), `${ipcSocketName}.sock`)
|
||||
if (process.platform === 'darwin' && !fs.existsSync(ipcSocketPath)) {
|
||||
fs.writeFileSync(ipcSocketPath, '')
|
||||
// 设置权限(Unix)
|
||||
fs.chmodSync(ipcSocketPath, 0o777)
|
||||
}
|
||||
}
|
||||
const ipcSocketPath = process.platform === 'win32'
|
||||
? `\\\\.\\pipe\\${ipcSocketName}`
|
||||
: path.join(tmpdir(), `${ipcSocketName}.sock`)
|
||||
|
||||
const workers = new Map(); // workerId -> { process, status, restartCount, socket, latestScreenshot, latestScreenshotAt }
|
||||
const guiClients = new Set(); // GUI客户端连接集合
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
"cli-highlight": "^2.1.11",
|
||||
"lodash": "^4.17.21",
|
||||
"reflect-metadata": "^0.2.1",
|
||||
"sqlite3": "5.1.6",
|
||||
"typeorm": "0.3.11"
|
||||
"better-sqlite3": "12.6.2",
|
||||
"typeorm": "0.3.28"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/lodash": "^4.17.23",
|
||||
|
||||
@@ -21,7 +21,6 @@ import { ChatMessageRecord } from './entity/ChatMessageRecord'
|
||||
import { LlmModelUsageRecord } from './entity/LlmModelUsageRecord'
|
||||
import { JobHireStatusRecord } from './entity/JobHireStatusRecord'
|
||||
|
||||
import sqlite3 from 'sqlite3';
|
||||
import {
|
||||
saveChatStartupRecord,
|
||||
saveJobInfoFromRecommendPage,
|
||||
@@ -45,12 +44,11 @@ import * as typeorm from 'typeorm'
|
||||
export function initDb(dbFilePath) {
|
||||
const { DataSource } = typeorm
|
||||
const appDataSource = new DataSource({
|
||||
type: "sqlite",
|
||||
type: "better-sqlite3",
|
||||
synchronize: false,
|
||||
logging: true,
|
||||
logger: "simple-console",
|
||||
database: dbFilePath,
|
||||
driver: sqlite3, // The important line
|
||||
entities: [
|
||||
ChatStartupLog,
|
||||
BossInfo,
|
||||
|
||||
@@ -48,10 +48,10 @@
|
||||
"@electron-toolkit/eslint-config": "^1.0.2",
|
||||
"@electron-toolkit/eslint-config-ts": "^1.0.1",
|
||||
"@electron-toolkit/tsconfig": "^1.0.1",
|
||||
"@inquirer/prompts": "^7.0.1",
|
||||
"@inquirer/select": "^4.0.1",
|
||||
"@geekgeekrun/dingtalk-plugin": "workspace:*",
|
||||
"@geekgeekrun/geek-auto-start-chat-with-boss": "workspace:*",
|
||||
"@inquirer/prompts": "^7.0.1",
|
||||
"@inquirer/select": "^4.0.1",
|
||||
"@puppeteer/browsers": "^2.11.0",
|
||||
"@rushstack/eslint-patch": "^1.7.1",
|
||||
"@types/lodash": "^4.17.23",
|
||||
@@ -64,7 +64,7 @@
|
||||
"@vue/eslint-config-typescript": "^12.0.0",
|
||||
"animate.css": "^4.1.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"electron": "28.2.0",
|
||||
"electron": "39.2.7",
|
||||
"electron-builder": "^24.9.1",
|
||||
"electron-vite": "^2.0.0",
|
||||
"element-plus": "^2.8.4",
|
||||
@@ -87,4 +87,4 @@
|
||||
"vue-router": "^4.2.5",
|
||||
"vue-tsc": "^1.8.27"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,8 @@ export async function connectToDaemon() {
|
||||
await new Promise((resolve, reject) => {
|
||||
const ipcSocketName = process.env.GEEKGEEKRUND_PIPE_NAME
|
||||
const ipcSocketPath = process.platform === 'win32'
|
||||
? `\\\\.\\pipe\\${ipcSocketName}`
|
||||
: path.join(tmpdir(), `${ipcSocketName}.sock`)
|
||||
if (process.platform === 'darwin' && !fs.existsSync(ipcSocketPath)) {
|
||||
fs.writeFileSync(ipcSocketPath, '')
|
||||
// 设置权限(Unix)
|
||||
fs.chmodSync(ipcSocketPath, 0o777)
|
||||
}
|
||||
? `\\\\.\\pipe\\${ipcSocketName}`
|
||||
: path.join(tmpdir(), `${ipcSocketName}.sock`)
|
||||
daemonClient.connect(ipcSocketPath, 'localhost', () => {
|
||||
isConnected = true
|
||||
console.log('已连接到守护进程');
|
||||
|
||||
@@ -20,7 +20,7 @@ export const initDbWorker = () => {
|
||||
// attach more event
|
||||
worker?.off('message', handler)
|
||||
} else if (data.type === 'DB_INIT_FAIL') {
|
||||
reject(undefined)
|
||||
reject(data.error)
|
||||
worker?.terminate()
|
||||
worker?.off('message', handler)
|
||||
worker = null
|
||||
|
||||
1039
pnpm-lock.yaml
generated
1039
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user