Commit Graph

18 Commits

Author SHA1 Message Date
Codex Agent a5d56ade26 cleanup: remove test checkpoint 2025-10-30 12:01:23 +08:00
Codex Agent 40742b2232 fix: ensure danger modal appears on top of checkpoint modal
Issue:
- Restore checkpoint confirmation dialog (dangerModal) was hidden behind checkpoint management modal
- z-index of dangerModal (1000) was same as checkpointModal, causing layering issues

Solution:
- Increased z-index of .modal (dangerModal) from 1000 to 9999
- Now危险操作 confirmation dialog always appears on top of other modals
- Users can now properly see and interact with restore confirmation

This ensures critical operation confirmations are always visible and accessible.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 12:00:57 +08:00
Codex Agent 55dd684bbd cleanup: remove test checkpoint file 2025-10-30 11:54:39 +08:00
Codex Agent 1fa9385d02 fix: resolve UUID JSON serialization error in checkpoint creation
Issue:
- Object of type <class 'uuid.UUID'> is not JSON serializable error when creating checkpoints
- UUID objects in database records couldn't be serialized to JSON

Solution:
- Updated json_serializer function in create_checkpoint() to properly handle UUID types
- Added explicit isinstance check for uuid.UUID before checking for isoformat
- Ensures all UUID values are converted to strings before JSON serialization

This ensures checkpoints can be created successfully with all database data types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 11:52:06 +08:00
Codex Agent 7ddec0fb4f refactor: move checkpoint management to separate modal window
Changes:
- Removed checkpoint from main workflow (step 5)
- Added standalone "检查点管理" button in top toolbar
- Created dedicated modal window for checkpoint management
- Updated UI to be more user-friendly and separate concerns

Benefits:
- Checkpoint management is now a standalone feature
- Doesn't interfere with the main database maintenance flow
- Modal window provides better focused interface
- Users can access checkpoints anytime without losing their place in the workflow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 11:48:15 +08:00
Codex Agent 9530eabac8 feat: add database checkpoint management system
Features:
- Create manual database checkpoints with descriptions
- List all available checkpoints with statistics
- Restore database from checkpoints (with dangerous operation warning)
- Delete unwanted checkpoints
- Frontend UI integrated into database admin panel
- JSON-based checkpoint storage in data/checkpoints/

Backend Changes:
- Added checkpoint management functions to licensing_repo.py:
  * create_checkpoint() - backup all tables to JSON
  * list_checkpoints() - enumerate checkpoint files
  * restore_checkpoint() - restore from checkpoint
  * delete_checkpoint() - remove checkpoint file
- Added 4 new API endpoints to v2.py:
  * GET /admin/checkpoints - list checkpoints
  * POST /admin/checkpoints - create checkpoint
  * POST /admin/checkpoints/{id}/restore - restore checkpoint
  * DELETE /admin/checkpoints/{id} - delete checkpoint

Frontend Changes (db_admin.html):
- Added step 5 "检查点管理" to navigation
- Created checkpoint management UI with forms and lists
- Added dangerous operation confirmation modal
- Integrated into existing breadcrumb navigation system

Safety Features:
- All dangerous operations require explicit confirmation
- Restore operations show warning about data loss
- Checkpoints include row counts and table statistics
- Timestamped checkpoint IDs for easy identification

Note: Checkpoint files are stored in data/checkpoints/ directory

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 10:33:35 +08:00
Codex Agent 506ea5ce98 feat: optimize database admin UI with improved navigation
 Major Improvements:
- Layout optimization: Reduced navigation panel to 350px, maximized content area
- Navigation centralization: All operations in left panel with unified workflow
- History stack management: Implemented step-by-step back navigation
- Loading animations: Added loading spinners for all async operations
- Scrollable lists: Added custom scrollbar for long theme lists (max-height: 600px)
- Breadcrumb navigation: Visual path tracking with quick jump functionality

🎨 User Experience:
- Navigation paths show current position (e.g., Home › 市级 › 开办电影院)
- Clickable breadcrumbs for fast navigation to any step
- "Back" button for sequential navigation
- "Home" button to reset all selections
- Custom scrollbar styling matching UI design
- Responsive design with proper overflow handling

🔧 Technical Implementation:
- Step state machine (1→2→3→4 workflow)
- History stack for multi-step navigation
- Dynamic breadcrumb generation
- Smart state cleanup on quick jumps
- Loading states for all API operations

📁 Files Modified:
- static/db_admin.html: Complete UI/UX overhaul (734 lines)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 09:54:36 +08:00
Codex Agent cbefb81a35 feat: 实现数据库维护功能
## 新增功能

### 1. 后端API路由 (lawrisk/api/v2.py)
- 添加了5个新的管理API端点:
  * GET /admin/regions - 获取地区列表
  * GET /admin/themes - 获取主题列表(按地区筛选)
  * GET /admin/permits - 获取许可列表(按地区和主题筛选)
  * GET /admin/permit-details - 获取许可详细信息
  * GET /admin/test - 测试路由

### 2. 前端管理界面 (static/db_admin.html)
- 实现了完整的数据库维护管理页面
- 4步操作流程:地区选择 → 主题列表 → 许可列表 → 详细信息展示
- 现代化UI设计,包括:
  * 渐变背景和响应式布局
  * 平滑动画过渡效果
  * 实时数据加载提示
  * 完整的许可信息展示(许可状态、经营范围、法律风险等)

## 技术实现
- RESTful API设计,返回标准JSON格式
- 直接从PostgreSQL数据库读取数据
- 所有API已通过curl和Flask测试客户端验证

## 测试结果
在端口8888上测试通过:
- admin/regions: 1个地区
- admin/themes: 57个主题
- admin/permits: 6个许可
- admin/permit-details: 完整许可信息和3个风险记录
- 静态页面: 成功加载

## 使用方法
```bash
# 启动服务
PORT=8888 python app.py &

# 访问管理界面
http://localhost:8888/static/db_admin.html

# API调用示例
curl http://localhost:8888/fs-ai-asistant/api/workflow/lawrisk/admin/regions
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 08:52:48 +08:00
Codex Agent bfda66afc1 refactor: 重新规划项目结构为标准Python包
主要变更:
- 重组项目目录结构,采用标准Python包组织方式
  * 创建 lawrisk/ 主包
  * 分离 API 路由层 (api/v1.py, api/v2.py)
  * 封装业务逻辑层 (services/)
  * 抽取中间件 (middleware/)
  * 整理工具模块 (utils/)

- 重构应用入口
  * 使用 Flask Blueprint 注册路由
  * 简化 app.py 逻辑

- 添加项目文档
  * 创建 README.md 项目说明
  * 创建 requirements.txt 依赖管理
  * 统一文档到 docs/ 目录

- 文件组织优化
  * 数据文件移动到 data/
  * 测试目录 tests/ 准备就绪

- 修复导入路径
  * 更新所有模块导入为相对路径
  * 确保应用正常启动运行

验证:
 应用成功启动在端口 8000
 所有路由正确注册
 健康检查端点正常响应

Closes: #重构项目结构
2025-10-29 15:31:01 +08:00
Codex Agent be25619fa8 feat: add v2 tester page and LLM logging 2025-10-24 11:30:36 +08:00
Codex Agent bba9dea59d feat: surface permit metadata in v2 responses 2025-10-24 10:57:14 +08:00
Codex Agent e1705198f3 Revert "feat: surface permit metadata in v2 results"
This reverts commit 96ab06558f.
2025-10-24 09:05:31 +08:00
Codex Agent 628a4f1435 Revert "Revert "feat: surface permit metadata in v2 results""
This reverts commit 33bbbb7d8c.
2025-10-24 09:05:21 +08:00
Codex Agent 33bbbb7d8c Revert "feat: surface permit metadata in v2 results"
This reverts commit 96ab06558f.
2025-10-24 09:00:39 +08:00
Codex Agent 96ab06558f feat: surface permit metadata in v2 results 2025-10-23 17:35:57 +08:00
Codex Agent 90b1c06862 feat: enrich lawrisk v2 with permit scopes 2025-10-23 16:15:46 +08:00
Codex Agent cc1bda89a4 feat: add database-backed lawrisk v2 endpoint 2025-10-23 14:15:37 +08:00
Codex Agent d6d92fd966 chore: initial commit 2025-10-22 20:00:32 +08:00