Commit Graph

5 Commits

Author SHA1 Message Date
RainySY
6f9ffc59f3 feat: support any OpenAI-compatible AI API
Backend:
- Add apiEndpoint / apiModel fields to App struct (configurable, with Deepseek defaults)
- New SetAIConfig(endpoint, model, key) unified config method
- New SetAPIKey(key) for key-only updates
- GetAIStatus() returns { ready, endpoint, model }
- callDeepseekAPI → callAIAPI with configurable endpoint and model
- Remove hardcoded Deepseek URL/model; defaults remain as fallback

Frontend:
- Replace Deepseek-specific state with generic AI config (endpoint / model / key)
- Add endpoint URL and model name input fields
- saveApiKey → saveApiConfig using SetAIConfig
- onMounted restores full AI config via GetAIStatus
- Rename all user-facing 'Deepseek' labels to 'AI / AI API'

Now supports: Deepseek, OpenAI, Ollama, vLLM, or any OpenAI-compatible endpoint.
2026-05-20 14:33:10 +08:00
RainySY
b5a91cb115 perf: optimize hot path & reorganize project config
Backend (app.go):
- AICache: replace linear scan with map-based O(1) lookup (get/getRow/put/putRow)
- runMatchOnData: pre-compute B-column cleaned values, parsed times, extract values
  to eliminate O(n*m) regex/time-parse from inner loop
- calcSimilarity: eliminate double rune conversion (levenshteinDistance now takes []rune)
- Add similarityFromCleaned to skip redundant regex step in hot path
- Fix corrupted bare 'n' literal causing build failure
- Move saveToFile out of inner match loop (was called per item)
- dataMu: Mutex -> RWMutex (exportHeaders/ExportResults use RLock)
- buildGenericAIPrompt: fix truncation check order (check after write)

Project:
- .gitignore: deduplicate & tighten rules; track package-lock.json and .vscode/*
- Clean up stale root binary (data-matcher.exe)
2026-05-20 14:16:13 +08:00
RainySY
b3ec20fd77 fix: 修复代码审查发现的8项问题
- P0: 新增 RunMatchWithAI (配置驱动) 替代 DeepseekEnhanceMatching 的硬编码阈值
- P0: 前端 startAIEnhance 使用 fileAPath/fileBPath 替代未赋值的 monthlyPath/dailyPath
- P1: reasonMap 移至批循环外仅构建一次; CSV 转义双引号支持; twoHours 变量重命名
- P2: 删除 rowAndScore; calcSimilarity 实现 CaseSensitive; AI 解析失败增加日志
- 时间窗口过滤改用用户配置的 windowDuration 替代硬编码 3h; 旧函数标注弃用
2026-05-07 02:09:29 +08:00
RainySY
d31c3e46f5 feat: AI 缓存系统 + 优化 prompt 构建
- 新增 AICache 持久化缓存(SHA256 键,存储于临时文件)
- callDeepseekAPI 自动查缓存,命中跳过 API 调用
- buildAIPrompt 按时间窗口过滤日报记录,减少 token 消耗
- AI 结果匹配改用 map 查找替代 O(n²) 遍历
- 前端添加缓存状态显示和「清除缓存」按钮
- 新增 ClearAICache / GetAICacheInfo 绑定方法
2026-05-07 01:26:44 +08:00
RainySY
2cef098632 feat: Initialize data-matcher project with Wails framework
- Added frontend runtime JavaScript functions for logging, window management, and notifications.
- Created Go module with dependencies for Wails and Excel processing.
- Implemented main application entry point with embedded frontend assets.
- Configured Wails application settings in wails.json.

Co-authored-by: Copilot <copilot@github.com>
2026-05-07 01:11:05 +08:00