Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
75c754baf0 chore(deps): bump koffi from 2.15.2 to 2.15.6
Bumps [koffi](https://github.com/Koromix/koffi) from 2.15.2 to 2.15.6.
- [Commits](https://github.com/Koromix/koffi/commits)

---
updated-dependencies:
- dependency-name: koffi
  dependency-version: 2.15.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-08 11:44:46 +00:00
3 changed files with 27 additions and 16 deletions

View File

@@ -15,8 +15,10 @@
import https from 'https'
import http from 'http'
import fs from 'fs'
import path from 'path'
import { URL } from 'url'
import { Notification } from 'electron'
import { app, Notification } from 'electron'
import { ConfigService } from './config'
import { chatService, ChatSession, Message } from './chatService'
@@ -51,17 +53,33 @@ interface TodayTriggerRecord {
timestamps: number[]
}
// ─── 日志 ─────────────────────────────────────────────────────────────────────
// ─── 桌面日志 ─────────────────────────────────────────────────────────────────
/**
* 输出到 console,不落盘到文件。
* 将日志同时输出到 console 和桌面上的 weflow-insight.log 文件。
* 文件名带当天日期,每天自动换一个新文件,旧文件保留。
*/
function insightLog(level: 'INFO' | 'WARN' | 'ERROR', message: string): void {
const now = new Date()
const dateStr = now.toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-')
const timeStr = now.toLocaleTimeString('zh-CN', { hour12: false })
const line = `[${dateStr} ${timeStr}] [${level}] ${message}\n`
// 同步到 console
if (level === 'ERROR' || level === 'WARN') {
console.warn(`[InsightService] ${message}`)
} else {
console.log(`[InsightService] ${message}`)
}
// 异步写入桌面日志文件,避免同步磁盘 I/O 阻塞 Electron 主线程事件循环
try {
const desktopPath = app.getPath('desktop')
const logFile = path.join(desktopPath, `weflow-insight-${dateStr}.log`)
fs.appendFile(logFile, line, 'utf-8', () => { /* 失败静默处理 */ })
} catch {
// getPath 失败时静默处理
}
}
// ─── 工具函数 ─────────────────────────────────────────────────────────────────
@@ -227,19 +245,12 @@ class InsightService {
}
stop(): void {
const hadActiveFlow =
this.dbDebounceTimer !== null ||
this.silenceScanTimer !== null ||
this.silenceInitialDelayTimer !== null ||
this.processing
this.started = false
this.clearTimers()
this.clearRuntimeCache()
this.processing = false
if (hadActiveFlow) {
insightLog('INFO', '已停止')
}
}
async handleConfigChanged(key: string): Promise<void> {
const normalizedKey = String(key || '').trim()

8
package-lock.json generated
View File

@@ -20,7 +20,7 @@
"html2canvas": "^1.4.1",
"jieba-wasm": "^2.2.0",
"jszip": "^3.10.1",
"koffi": "^2.9.0",
"koffi": "^2.15.6",
"lucide-react": "^1.7.0",
"react": "^19.2.3",
"react-dom": "^19.2.3",
@@ -6537,9 +6537,9 @@
}
},
"node_modules/koffi": {
"version": "2.15.2",
"resolved": "https://registry.npmjs.org/koffi/-/koffi-2.15.2.tgz",
"integrity": "sha512-r9tjJLVRSOhCRWdVyQlF3/Ugzeg13jlzS4czS82MAgLff4W+BcYOW7g8Y62t9O5JYjYOLAjAovAZDNlDfZNu+g==",
"version": "2.15.6",
"resolved": "https://registry.npmjs.org/koffi/-/koffi-2.15.6.tgz",
"integrity": "sha512-WQBpM5uo74UQ17UpsFN+PUOrQQg4/nYdey4SGVluQun2drYYfePziLLWdSmFb4wSdWlJC1aimXQnjhPCheRKuw==",
"hasInstallScript": true,
"license": "MIT",
"funding": {

View File

@@ -34,7 +34,7 @@
"html2canvas": "^1.4.1",
"jieba-wasm": "^2.2.0",
"jszip": "^3.10.1",
"koffi": "^2.9.0",
"koffi": "^2.15.6",
"lucide-react": "^1.7.0",
"react": "^19.2.3",
"react-dom": "^19.2.3",