Commit Graph

46 Commits

Author SHA1 Message Date
houhuan d5b4cc7b77 docs: expand Docker deployment instructions in README
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 22:38:58 +08:00
houhuan 5e69e5a841 feat: add Docker deployment (backend:18889, frontend:18888)
- Dockerfile.backend: Python 3.11 + FastAPI + uvicorn
- Dockerfile.frontend: Node 20 build + Nginx serve
- docker-compose.yml: orchestration with data volume mount
- nginx.conf: API/WebSocket proxy to backend
- web/backend/requirements.txt: Python dependencies
- .dockerignore: exclude venv/node_modules/data from build

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 22:36:52 +08:00
houhuan 0c28031e81 docs: update README with web features, remove dev planning docs
- Add Web 端功能 section covering all features
- Add web/ directory to project structure
- Add Web startup instructions (backend + frontend)
- Remove docs/superpowers/ (internal dev planning docs)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 20:53:25 +08:00
houhuan 7dabb2ce66 fix: dialog width 75% instead of fullscreen
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 19:59:33 +08:00
houhuan 2196a25aee fix: detail dialog matches preview dialog style (fullscreen)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 19:56:16 +08:00
houhuan 7baf784a39 feat: processing flow enhancement + responsive UI
Phase 2 - Processing flow:
- Multi-task monitoring: store supports concurrent task tracking
- Task retry: POST /api/tasks/{id}/retry re-runs failed tasks
- Dashboard multi-task cards with progress, error details, retry/dismiss
- Log panel expanded from 10 to 50 lines with "view all" link

Phase 3 - UI/UX:
- Mobile sidebar drawer (< 768px) with hamburger menu
- Layout responsive styles (768px, 480px breakpoints)
- Tasks/Logs pages responsive (stat cards, filters, columns)
- File views responsive (header wrap, button sizing)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 19:18:18 +08:00
houhuan 32af38fe2a docs: add processing flow + UI/UX enhancement plan
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 19:09:27 +08:00
houhuan 13ef605481 feat: auto-sync file list + clear processing cache
- Auto-sync file_relations on every query (files appear immediately)
- Add POST /api/files/reset-cache endpoint to delete output/result
  files and reset status to pending for reprocessing
- Add "清除处理缓存" button to all 3 file views

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 22:18:47 +08:00
houhuan ec8d0d7db6 fix: handle empty catch in Tables.vue clearAll
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 21:49:58 +08:00
houhuan 17c45cab3f feat: add batch-delete API endpoint, replace N+1 frontend calls
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 21:45:28 +08:00
houhuan 3a49780d8d refactor: remove dead code (pollTaskStatus, routeLoadingTimer)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 21:43:15 +08:00
houhuan 3f8e34c07f fix: add error handling to Barcodes, Tasks, Logs, Sync views
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 21:41:50 +08:00
houhuan d94e416202 fix: Memory.vue stats fallback and error handling 2026-05-12 21:40:24 +08:00
houhuan fa43a9770e refactor: Orders.vue uses shared composables, fix error handling 2026-05-12 21:38:45 +08:00
houhuan 1a4522bd02 refactor: Tables.vue uses shared composables, fix error handling 2026-05-12 21:35:10 +08:00
houhuan 7e15431937 refactor: Images.vue uses shared composables, fix error handling
- Import statusType/statusText/fmtTime from useFileUtils composable
- Use useFilePreview composable for preview state and logic
- Remove duplicated preview refs, cleanupPreview, and utility functions
- Add try/finally to loadData for reliable loading state
- Properly handle cancel vs error in deleteFile and batchDelete

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 21:31:40 +08:00
houhuan 7e63dda522 fix: fetchUser on mount, password validation, remove dead code
- Call authStore.fetchUser() in onMounted so avatar shows username after refresh
- Simplify navigator.onLine checks (remove redundant !== false)
- Remove unused navItems array (dead code from earlier iteration)
- Add password form validation with confirm password field and rules

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 21:29:03 +08:00
houhuan 26f6275f4e fix: add global Vue error handler with user-facing toast 2026-05-12 21:26:38 +08:00
houhuan 2d79c05cf1 refactor: add useFilePreview composable for shared preview logic 2026-05-12 21:25:08 +08:00
houhuan 50ee6ac5bd refactor: add useFileUtils composable for shared file helpers 2026-05-12 21:23:28 +08:00
houhuan 2a2b4c639e refactor: extract useDebounce composable from 4 duplicate copies
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 21:19:30 +08:00
houhuan beaf7c6203 docs: add frontend bug fix and code quality implementation plan
12 tasks covering: useDebounce/useFileUtils/useFilePreview composables,
global error handler, fetchUser fix, file view refactoring, error handling
across 9 views, dead code cleanup, password validation, batch-delete API.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 21:14:29 +08:00
houhuan 7c3616ff98 docs: add frontend bug fix and code quality design spec
Addresses 11 issues across 3 phases: critical bug fixes (fetchUser,
silent errors, loading states, stats fallback, global error handler),
code quality (extract composables, remove dead code), and minor
improvements (password validation, batch delete endpoint).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 21:06:05 +08:00
houhuan e441ac82a8 Refactor processing logic and enhance error handling
- Cleaned up code in processing.py by removing inline semicolons and improving readability.
- Updated upsert_file_relation calls to ensure consistent handling of file relations.
- Enhanced query_file_relations in db_schema.py to support filtering by file existence.
- Improved API error handling in index.ts with user-friendly messages for 401 and 403 errors.
- Added online/offline status tracking in Layout.vue.
- Implemented debounced search functionality across multiple views to optimize performance.
- Introduced loading skeletons in Dashboard.vue for better user experience during data fetching.
- Enhanced file preview cleanup logic in Images.vue, Orders.vue, and Tables.vue to prevent memory leaks.
- Updated global styles to include new loading and notification animations.
2026-05-12 18:37:23 +08:00
houhuan 81bafaf557 fix: sync/barcode/memory overhaul + detailed logs + preview + result tracking
- Sync: fix GiteaSync constructor + add push()/pull() methods
- Barcode: two-tab layout matching GUI (mapping + special rules)
- Memory: spec→specification unification, manual add, confidence/price tracking
- Processing: TaskLogHandler captures detailed logs (barcode mapping, unit conversion)
- Preview: fullscreen dialog for file preview (image/Excel) in Orders/Tables/Images
- Detail: per-file log filtering in file pages
- Tasks: result files now per-task, add copy path button
- Config: reactive edited state + save_config fix
- Dashboard: sync task isolation, log limit 10

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 19:37:10 +08:00
houhuan c18039f790 feat: 重构仪表盘布局并优化交互 2026-05-05 16:05:59 +08:00
houhuan 0721ed099c @
feat: shadcn主题 + 文件关系追踪 + 处理流程修复

前端:
- 全站应用 shadcn/ui 主题 (zinc灰调, Inter字体, 1px细边框, 无硬阴影)
- 重写 global.css / Dashboard.vue / Login.vue / Layout.vue 样式
- 新增文件处理子页面: 采购单(Orders), 表格处理(Tables), 图片处理(Images)
- 侧边栏使用 el-sub-menu 组织文件处理导航

后端:
- 新增 file_relations 表追踪 input→output→result 链路
- 新增 /files/relations, /files/stats/detailed 等关系查询API
- 新增 ocr-single, excel-single, pipeline-single, merge-batch 端点
- 处理流程增加跳过逻辑 (已处理文件自动跳过)
- 全流程不再自动合并, 合并仅在采购单页面手动触发

Bug修复:
- TaskManager: asyncio.create_task 在线程池中无事件循环 → 改用 _schedule() 调度
- PurchaseOrderMerger 缺少 config 参数 → 传入 ConfigManager()
- FastAPI regex= 弃用 → 改为 pattern=
- merger.process() 接收 Path 对象 → 转为字符串
@
2026-05-05 14:16:30 +08:00
houhuan dedc3b4183 feat: complete web application — FastAPI backend + Vue 3 SPA frontend
- Full FastAPI backend with JWT auth, file management, processing pipeline,
  memory CRUD, barcode mappings, config management, cloud sync
- Vue 3 + Element Plus frontend with dashboard, task history, HTTP logs,
  memory editor, barcode editor, config editor, sync page
- HTTP request logging middleware with SQLite persistence
- Task history tracking with progress and retry support
- File metadata recording for upload/download operations
- WebAuth section in config.ini for bcrypt password storage
- Bug fix: logs.py count query returns tuple not dict

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 11:59:07 +08:00
houhuan 79522d8356 feat: add task history query and retry API endpoints 2026-05-05 11:33:40 +08:00
houhuan c49105a678 feat: add HTTP log query API endpoints
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 11:33:23 +08:00
houhuan 5de8694eec feat: persist task lifecycle to SQLite via TaskManager 2026-05-05 11:32:07 +08:00
houhuan 205e18563d feat: record file operations to metadata table + add history/stats endpoints
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 11:32:04 +08:00
houhuan 56561068ea feat: add HTTP request logging middleware 2026-05-05 11:31:47 +08:00
houhuan 280b94ae1d feat: add db_schema for http_logs, task_history, file_metadata tables 2026-05-05 11:29:41 +08:00
houhuan 71c0ba9c96 docs: add implementation plan for logging, task history, and file management
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 11:25:02 +08:00
houhuan c1826918aa docs: add design spec for logging, task history, and file management
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 11:19:14 +08:00
houhuan d267a1d1fa @
feat: 商品记忆库 — 从OCR结果学习,逐步替代OCR识别

- 扩展 product_db.py: schema迁移(specification/source/confidence/usage_count/last_seen)
  + 学习逻辑(learn_from_product)、置信度系统、批量查询、导入导出、云端同步
- 注入处理管线: processor.py 在提取产品后调用 _apply_memory() 用记忆补全OCR
  + _is_spec_suspicious() 检测OCR规格质量,处理完后自动学习
- order_service.py 创建共享 ProductDatabase 实例
- dialog_utils.py 新增商品记忆库云端同步条目
- 新建 memory_editor.py: Treeview查看/编辑/搜索/删除/重新导入
- main_window.py 系统设置区新增"商品记忆库"按钮
- build_exe.py 添加 memory_editor 到 hidden_imports
@
2026-05-05 02:40:48 +08:00
houhuan 5cf9a98d9a fix: 预处理文件输出到配置目录而非源文件目录
烟草/杨碧月/蓉城易购的预处理文件(预处理之后_xxx)之前写入源文件所在目录,
现在改为写入配置的 output_folder 目录。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 02:14:14 +08:00
houhuan 6f96bf50ac fix: 修复输出路径问题 — 路径解析改为基于应用目录而非CWD
当从外部目录(如D:\ccc)拖入文件时,输出文件会错误地写入源目录。
根因是所有路径使用相对路径 + os.getcwd() 解析,CWD不同则路径错误。

修复方案:
- ConfigManager.get_path() 改为使用 app_root (exe所在目录/脚本所在目录)
- 将 22 处裸硬编码 "data/result"/"data/output" 替换为 config.get_path()
- 添加 result_folder 到默认配置和 config.ini
- 修复 error_utils.py 中的路径匹配字符串

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 23:05:10 +08:00
houhuan 6fd14b4e49 fix: EXE版禁用一键安装拖拽,打包时集成tkinterdnd2
- EXE版(sys.frozen)不显示安装按钮,提示用源码版安装后重新打包
- tkinterdnd2 加入 hidden_imports,打包时自动带上

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 21:26:29 +08:00
houhuan 4f0efcd0c0 fix: 修复PyInstaller打包缺失dotenv等模块
- 添加 dotenv 到 hidden_imports
- 添加 processor_service, file_utils, log_utils, string_utils, column_mapper

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 21:14:48 +08:00
houhuan 7f820ca447 chore: 更新配置文件中的 token 2026-05-04 20:33:31 +08:00
houhuan 11402c2196 fix: 移除无用的重新加载供应商按钮,调整列表高度参数
- 设置对话框移除「重新加载供应商配置」按钮(云端同步已自动处理)
- 清理 _PROCESSOR_SERVICE 全局变量
- 列表最小高度 300→240,动态比例保持 80%

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 20:32:00 +08:00
houhuan 5bf51c36a0 fix: 最近文件列表最小高度保障 + 欢迎文字读取配置版本号
- 列表动态高度从 75% 改为 85%,最小 300px
- 欢迎信息版本号从硬编码 v1.1.0 改为读取 config.ini

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 20:22:38 +08:00
houhuan 3c25a1bf4d fix: 优化GUI布局 — 最近文件高度增加、设置对话框改为双列
- 最近文件列表框高度 12→20(增加 2/3)
- 系统设置对话框从 560x680 单列改为 700x460 双列布局
- 设置项分为 3 个区块:基本设置、API设置、云端同步
- 保存按钮始终可见,无需滚动

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 20:17:22 +08:00
houhuan e4d62df7e3 feat: 益选 OCR 订单处理系统初始提交
- 智能供应商识别(蓉城易购/烟草/杨碧月/通用)
- 百度 OCR 表格识别集成
- 规则引擎(列映射/数据清洗/单位转换/规格推断)
- 条码映射管理与云端同步(Gitea REST API)
- 云端同步支持:条码映射、供应商配置、商品资料、采购模板
- 拖拽一键处理(图片→OCR→Excel→合并)
- 191 个单元测试
- 移除无用的模板管理功能
- 清理 IDE 产物目录

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 19:51:13 +08:00