Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
312a9b76b4 chore(deps-dev): bump vite from 7.3.2 to 8.0.7
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 7.3.2 to 8.0.7.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.7/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.0.7
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

View File

@@ -15,8 +15,10 @@
import https from 'https' import https from 'https'
import http from 'http' import http from 'http'
import fs from 'fs'
import path from 'path'
import { URL } from 'url' import { URL } from 'url'
import { Notification } from 'electron' import { app, Notification } from 'electron'
import { ConfigService } from './config' import { ConfigService } from './config'
import { chatService, ChatSession, Message } from './chatService' import { chatService, ChatSession, Message } from './chatService'
@@ -51,17 +53,33 @@ interface TodayTriggerRecord {
timestamps: number[] timestamps: number[]
} }
// ─── 日志 ───────────────────────────────────────────────────────────────────── // ─── 桌面日志 ─────────────────────────────────────────────────────────────────
/** /**
* 输出到 console,不落盘到文件。 * 将日志同时输出到 console 和桌面上的 weflow-insight.log 文件。
* 文件名带当天日期,每天自动换一个新文件,旧文件保留。
*/ */
function insightLog(level: 'INFO' | 'WARN' | 'ERROR', message: string): void { 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') { if (level === 'ERROR' || level === 'WARN') {
console.warn(`[InsightService] ${message}`) console.warn(`[InsightService] ${message}`)
} else { } else {
console.log(`[InsightService] ${message}`) 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,18 +245,11 @@ class InsightService {
} }
stop(): void { stop(): void {
const hadActiveFlow =
this.dbDebounceTimer !== null ||
this.silenceScanTimer !== null ||
this.silenceInitialDelayTimer !== null ||
this.processing
this.started = false this.started = false
this.clearTimers() this.clearTimers()
this.clearRuntimeCache() this.clearRuntimeCache()
this.processing = false this.processing = false
if (hadActiveFlow) { insightLog('INFO', '已停止')
insightLog('INFO', '已停止')
}
} }
async handleConfigChanged(key: string): Promise<void> { async handleConfigChanged(key: string): Promise<void> {

1283
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -57,7 +57,7 @@
"sass": "^1.99.0", "sass": "^1.99.0",
"sharp": "^0.34.5", "sharp": "^0.34.5",
"typescript": "^6.0.2", "typescript": "^6.0.2",
"vite": "^7.3.2", "vite": "^8.0.7",
"vite-plugin-electron": "^0.29.1", "vite-plugin-electron": "^0.29.1",
"vite-plugin-electron-renderer": "^0.14.6" "vite-plugin-electron-renderer": "^0.14.6"
}, },