539 Commits
Author SHA1 Message Date
yilv 1b46879048 Merge branch 'master' of http://www.yilvbuhuixiutu.cn:3000/yilv/rct_vue 2026-09-20 17:26:43 +08:00
yilv 7747442035 feat: update backend services, frontend views, and cleanup obsolete scripts 2026-09-20 17:24:37 +08:00
向宇康 93b0061387 feat(scripts): 新增 RBAC 权限与角色种子脚本 2026-09-18 15:49:39 +08:00
向宇康 8bc20226f8 fix(backend): 补充 integration 路由缺失的 RawDataFolder 导入 2026-09-18 15:49:39 +08:00
向宇康 7ba6136169 chore(frontend): 生产环境 API 地址改为 Nginx 同源代理 2026-09-18 15:49:39 +08:00
向宇康 8010facc01 fix(frontend): 修复刷新令牌自身 401 时等待回调造成登录页白屏 2026-09-18 15:49:32 +08:00
yilv 62e0197fe9 docs: 补充分层架构说明并同步 AGENTS 指引
新增 ARCHITECTURE.md 描述三层边界、异常约定与上传工厂;
更新 AGENTS.md 反映 service 迁移现状与巨型模块拆分规划。
2026-07-16 11:16:03 +08:00
yilv 5d273438b5 test(services): 新增用户/角色/标签/通知 service 单元测试
引入轻量测试 app fixture,覆盖 CRUD、冲突、权限与密码策略,
避免完整 create_app 导入重型依赖导致环境阻塞。
2026-07-16 11:16:03 +08:00
yilv 50df064db6 refactor(api): 统一上传工厂并收口路由异常处理
合并 crawler/models 上传为 register_upload_blueprint 工厂,
inference/integration 全面接入 @handle_service_errors;
ConflictError 统一返回 409,dashboard 异常与导出可见性一并收口。
2026-07-16 11:15:57 +08:00
yilv 0a29d8a0a6 feat(services): 强化业务服务层权限、校验与并发安全
- 密码复杂度校验、ConflictError 语义与 IntegrityError 兜底
- 用户审计日志、批量删除逐条提交、角色系统保护
- 上传会话行级锁与 hasher 线程安全
- dashboard 缓存 key 纳入角色、pipeline user_id 显式传入
- 信号处理失败改为抛出异常;services 包延迟导入重型依赖
2026-07-16 11:15:52 +08:00
yilv 8f1a5dd42f feat(core): 新增统一异常处理与上传 token 认证工具
抽取 @handle_service_errors 装饰器消除路由层 try/except 样板,
并新增 require_upload_token 共享装饰器;get_current_user 兼容
未初始化 login_manager 的轻量测试场景。
2026-07-16 11:15:47 +08:00
yilv 85b7d7a80f test: 更新集成测试以适应 service 层迁移 + 新增 AGENTS.md 项目指引
- test_integration_fixes.py: 更新文件路径检查(integration.py ->
  integration_service.py),适配函数命名变更(list_unified_data ->
  list_unified_data_service)
- AGENTS.md: 新增项目指引文档,涵盖架构分层、开发命令、数据库、
  安全认证、关键文档等开发规范
2026-07-10 14:11:16 +08:00
yilv a74ac992ba refactor(api): 路由层委托至 service 层,移除内联业务逻辑
所有 api 路由函数精简为薄适配器:解析请求参数 -> 调用 service 函数 ->
包装为 Flask 响应。移除大量内联 DB 查询、文件 I/O、数据处理代码:

- admin.py: 用户/标签管理委托至 user_service/tag_service
- admin_notifications.py: 通知管理委托至 notification_service
- admin_rbac.py: 角色/权限管理委托至 role_service/permission_service
- auth.py: 登录/刷新/资料委托至 auth_service
- crawler_uploads.py: 断点续传委托至 resumable_upload_service
- data_entries.py: 数据录入委托至 data_entry_service
- inference_new.py: 推理任务委托至 inference_service(-2345 行)
- integration.py: 集成管线委托至 integration_service(-4271 行)
- models.py: 模型管理委托至 model_management_service
- models_uploads.py: 模型上传委托至 resumable_upload_service
- routes.py: 仪表盘/通知委托至 dashboard_service
- search.py: 搜索委托至 search_service

__init__.py 同步更新内部导入路径(init_inference_timeout_checker、
sync_integration_folders_internal、auto_inference_scheduler)
2026-07-10 14:11:05 +08:00
yilv 531489a488 feat(services): 新增推理/集成/上传 façade 服务
将 api 路由中最大最复杂的业务逻辑模块抽取为服务层:

- inference_service: 数据预处理、ONNX 推理引擎、任务队列调度、
  进度事件总线、超时检测器初始化(原 inference_new.py 的核心逻辑)
- integration_service: 文件夹同步、数据过滤处理、自动推理调度、
  标签检测、研究员映射(原 integration.py 的核心逻辑)
- resumable_upload_service: 断点续传分片上传会话管理、增量哈希校验、
  上传完成/取消/状态查询,统一爬虫和模型两种上传配置
2026-07-10 14:10:22 +08:00
yilv d45ae678ec feat(services): 新增 CRUD 业务服务层
将 api 路由中的用户/角色/标签/权限/通知/数据录入/模型管理/搜索/仪表盘等
业务逻辑抽取为独立服务函数,路由层仅保留 HTTP 适配:

- auth_service: 登录认证、Token 刷新、用户资料
- user_service: 用户 CRUD、状态切换、批量删除、邮件列表
- role_service: 角色列表、创建/更新/删除
- tag_service: 标签列表、创建/删除
- permission_service: 权限列表、创建/删除、权限日志
- notification_service: 通知分页查询、创建/更新/发布/删除
- data_entry_service: 数据录入 CRUD、附件 I/O、CSV 导出
- model_management_service: 模型列表、扫描注册、文件上传
- search_service: 文件夹/数据条目序列化、统一数据查询
- dashboard_service: 仪表盘统计数据、公告通知
2026-07-10 14:09:41 +08:00
yilv 9a6b3543b1 feat(services): 新增基础服务层基础设施
- 新增 exceptions.py: BusinessError/NotFoundError/PermissionDeniedError/
  ValidationError/ConflictError/UnauthorizedError 业务异常体系
- 新增 signal_processing_helpers.py: 流式解压ZIP/CSV滤波/TXT转CSV辅助函数
- 更新 services/__init__.py: 统一导出异常类和流式处理/上传配置
2026-07-10 14:09:31 +08:00
yilv 7433669b8c chore: 将 .zcode/ 添加到 .gitignore 2026-07-10 11:24:55 +08:00
yilv ef7ba1c20b refactor: 整合数据库迁移为单一初始迁移,支持从零部署
删除 22 个增量迁移文件和 4 个独立 SQL/Python 脚本,压缩为
0001_initial_schema.py 单一初始迁移,以 models.py 为唯一 source of truth。

解决的问题:
- 消除分支混乱(2 个 merge 迁移、复杂依赖链)
- 消除废弃操作残留(data_source 表先建后删、user.role 列多次增删)
- 补全缺失表(inference_task、role、permission、tag、zip_filter_task 等
  原仅存在于独立脚本或 models.py 中,flask db upgrade 无法创建)
- 消除对独立脚本的依赖,从零部署仅需 flask db upgrade 一条命令

新迁移包含全部 30 张表(25 Model + 5 关联表)、68 个索引、
10 个唯一约束、7 条默认推理参数种子数据,附完整 downgrade。
2026-07-10 11:21:41 +08:00
yilv 0cb799a3fd fix: 修复前端性能问题(模板查找、key、防抖、异步组件)
- useInference.js: 新增 computed runningTaskMap(Map 索引),
  getRunningTask 等方法从 O(n) Array.find 改为 O(1) Map.get
- DataEntries/index.vue: 6 个对话框改 defineAsyncComponent 按需加载,
  筛选 handleFilterChange 添加 300ms 防抖
- InferenceAuto.vue: v-for :key 从 index 改为 task._uid 唯一标识
- ModelManagement.vue: 两处 :key 改组合键,parseClassLabels 改数据加载时预解析
- Home.vue: scroll 监听添加 100ms 节流
- Permissions.vue: resize 监听添加 100ms 防抖
- EmailManagement.vue: configChanged 从 JSON.stringify 深比较改浅比较
2026-07-10 11:21:31 +08:00
yilv 01e66bf4bd fix: 修复后端性能问题(N+1查询、pickle重复加载、缓存失效等)
- inference_new.py: AdaptivePatientDataset 增加文件级 LRU 缓存,
  __getitem__ 不再每次 pickle.load,N 窗口文件从 N 次反序列化降为 1 次
- inference_new.py: 推理循环内 progress 更新改用 flush 替代 commit,
  减少 DB 往返;per-batch 日志降级为 debug
- inference_new.py: ModelCache 缓存键加入 mtime/size,模型同名替换不再返回过期 session
- inference_new.py: get_inference_results 分页和单患者查询改批量查询消除 N+1
- inference_new.py: list_researchers 添加 joinedload/selectinload 预加载
- inference_new.py: batch_size 改用 get_batch_size() 动态配置生效
- inference_new.py: list_inference_data 添加 joinedload,refresh_data_status 添加 load_only
- inference_new.py + integration.py: pipeline 忙等轮询改 threading.Event 唤醒
- data_entries.py: 修复 Dashboard 缓存失效 bug(原删硬编码键不匹配动态键),改 cache.clear()
- data_entries.py: 导出接口改 stream_with_context 流式输出 + load_only + 预加载
- integration.py: list_integration_folders 添加 joinedload 消除 N+1
- routes.py: dashboard owned_folders 改 count() 查询避免加载完整对象
- auth.py: me() 添加 joinedload(User.roles) 预加载
- models.py(scan_model_files): hash 计算加 mtime/size 缓存避免重复计算
- crawler_uploads.py: 分片上传增量累积 hash,完成时不再重读整个文件
- __init__.py: 生产环境添加 RotatingFileHandler 日志轮转
- models.py: InferenceTaskResult 添加 (task_id, folder_id) 复合索引
2026-07-10 11:21:23 +08:00
yilv 8d221e7a32 test: add regression tests for integration.py fixes
Covers:
- Dead code removal (glob, run_integration_pipeline, parse_filter_type,
  INVERT_SIGNAL/ACC_LOWPASS_CUTOFF)
- has_filtered NameError bug fix verification
- AST static analysis for undefined variables in list_unified_data
- File integrity checks (syntax, key functions present)
2026-07-06 16:16:18 +08:00
yilv 8e6fb60d0c refactor: remove dead code and redundant definitions in integration.py
- Remove unused import: glob
- Remove unused import: run_integration_pipeline (from integrator_pipeline)
- Remove local parse_filter_type() definition that was shadowed by
  the import from services/signal_processing
- Remove redundant INVERT_SIGNAL and ACC_LOWPASS_CUTOFF constants
  (unused in code, duplicated from signal_processing config)
2026-07-06 16:16:14 +08:00
yilv d83dbfd96d fix: resolve NameError from undefined has_filtered in list_unified_data
list_unified_data() referenced has_filtered which was never defined
and does not exist on RawDataFolder model. Replace all three
references with has_pkl, which is the correctly computed variable
tracking processed PKL file existence.

Fixes runtime crash when accessing /admin/data/unified endpoint.
2026-07-06 16:15:41 +08:00
yilv 2a447e55b0 feat: add InferenceParams component for inference and queue management settings
- Created a new InferenceParams.vue component to manage inference parameters and queue settings.
- Removed the old automatic inference configuration and task queue from SystemSettings.vue.
- Integrated form validation for inference parameters and queue management settings.
- Implemented loading and saving functionality for the new settings.
2026-06-09 17:06:23 +08:00
yilv ffb7308d47 feat: 添加配置管理文本和首页标题到国际化文件 2026-06-09 16:53:34 +08:00
yilv 4017211644 refactor: 精简API消息文本,移除冗余内容并添加基本信息和密码修改相关文本 2026-06-09 16:50:18 +08:00
yilv b98f1586e3 refactor: 移除冗余的特性、CTA和页脚部分,简化Home组件 2026-06-09 16:37:44 +08:00
yilv 4a8372d75f refactor: 优化首页组件和国际化文本,移除冗余内容 2026-06-09 16:35:48 +08:00
yilv 18cb1fabf3 feat: 添加推理任务SSE实时进度推送
- 后端添加ProgressEventBus支持SSE实时推送推理进度
- 前端useInference支持SSE实时更新+轮询降级
- 更新ProgressDialog和TaskListDialog组件
- 添加CodeGraph到.gitignore
2026-06-09 16:31:26 +08:00
yilv 51cada90dc feat: add Home view and update router configuration
- Introduced a new Home.vue component with a hero section, features, workflow, tech highlights, and a call-to-action area.
- Updated the router to include a new route for the Home view and adjusted redirection logic for root path access.
- Enhanced navigation by allowing users to access the Home page directly and redirecting authenticated users to the Dashboard.
2026-06-09 16:01:48 +08:00
yilv f0d747018a chore(backend.prod): 替换生产环境密钥占位符为实际密钥
替换原有示例占位符密钥为符合规范的安全随机密钥,涵盖SECRET_KEY和JWT_SECRET_KEY两项配置
2026-05-30 17:40:19 +08:00
yilv 9ee8fe7d0a Merge branch 'master' of http://www.yilvbuhuixiutu.cn:3000/yilv/rct_vue 2026-05-30 17:22:04 +08:00
yilv dc36727c3e fix(后端): 修复模型管理API异常泄漏和废弃API
- 修复模型管理API中异常信息泄漏到客户端的问题
- 迁移datetime.utcnow为datetime.now(timezone.utc)
2026-05-30 17:20:09 +08:00
yilv 5e1113f132 fix(前端): 修复错误处理、编码损坏和代码清理
- ModelManagement.vue: 修复UTF-8编码损坏、删除死代码submitUpload、合并样式块
- Login.vue: 修复空catch块、改用authApi.login()、清理未使用import
- Profile.vue: 修复2处空catch块、移除未使用import
- Users/Permissions/PermissionLogs/Roles/Notifications/ConfigManagement:
  添加fetch函数try/catch和空catch块错误提示
- Roles.vue: save操作添加catch错误处理
- vite.config.js: visualizer open:true改为false
- Search/MainLayout: 清理未使用import
- useDialog.js: 显式import ElMessage
- api/config.js: URL参数改用axios params编码
- AnnouncementPopup.vue: localStorage操作添加try/catch保护
2026-05-30 17:19:28 +08:00
yilv 80cb0e3165 refactor(后端): 迁移datetime.utcnow为datetime.now(timezone.utc)
datetime.utcnow()在Python 3.12+已废弃,统一迁移到时区感知的
datetime.now(timezone.utc),涉及10个文件的全部调用。
2026-05-30 17:19:09 +08:00
yilv b1c45c7803 fix(后端): 修复服务层Bug和异常泄漏
- models.py: 修复异常信息泄漏到客户端
- data_entries.py: CSV导出增加10000行限制,防止OOM
- auto_update_service.py: os._exit(0)改为sys.exit(0)确保清理
- rbac_utils.py: 修复log_permission_change过早db.session.commit()
- base_queue_manager.py: heartbeat恢复添加嵌套事务保证原子性
- integrator_pipeline.py: 添加路径遍历防护和信号处理迁移备注
2026-05-30 17:18:36 +08:00
yilv 030af60f69 fix(后端): 修复关键Bug和安全问题
- system.py: 修复success().get_json()在tuple上崩溃的Bug
- admin_email.py: 错误响应使用HTTP 200改为500
- 删除重复的api/security.py,统一使用core/security.py
- search.py: 重定向security模块导入
- auth.py: 添加登录限流(10次/分钟)、密码强度验证(>=8字符)
- admin.py: 添加密码强度验证、operator null检查
2026-05-30 17:17:02 +08:00
yilv 32f0cd1dd0 feat(router): 为路由页面添加国际化动态标题
导入i18n实例,创建路由名称与i18n翻译键的映射关系,添加路由后置守卫以动态设置页面标题,无匹配项时默认显示RCT System。
2026-05-14 10:29:39 +08:00
yilv ad4c6928a7 chore: 将自动生成的类型声明文件移出 Git 跟踪
- components.d.ts 和 auto-imports.d.ts 由 unplugin 自动生成
- 添加到 .gitignore 避免每次构建产生冲突
2026-05-14 10:20:02 +08:00
yilv da0d0c89b0 fix(auth, components): 优化认证流程并清理组件类型定义
- 为API响应拦截器添加token刷新队列以处理并发401请求
- 在路由守卫中增加检查:存在access token但无refresh token时清除认证状态
- 清理未使用的Element Plus组件类型并补充缺失的单选组件类型
2026-05-14 10:15:26 +08:00
yilv f04af98ddd feat(file_utils): 添加支持Unicode的安全文件名处理函数并更新上传逻辑
新增secure_filename_unicode工具函数,保留中文等Unicode字符仅移除危险字符;替换原有werkzeug.secure_filename的使用,新增空文件名校验并更新爬虫与模型上传接口的处理逻辑
2026-05-13 23:18:10 +08:00
yilv 7f3c24239b feat(上传接口): 新增断点续传ONNX模型上传并更新爬虫上传规则
- 新增models_uploads蓝图,实现支持ONNX格式的断点续传分片上传功能,包含会话持久化、哈希校验、进度查询和取消上传
- 修改crawler_uploads接口的允许文件格式为zip/rar/7z,并更新对应的MIME类型白名单
- 注册新的上传蓝图并配置CSRF和限流豁免
2026-05-12 17:50:22 +08:00
yilv ce27ea5fb8 refactor(前端): 简化研究结果表格列,移除冗余信息
移除总窗口数、有效窗口数、SQA通过率和时间戳列,使表格更专注于展示任务名称等核心信息。
2026-05-08 17:46:07 +08:00
yilv 9906d9a908 feat(admin): 添加SMTP配置指南页面和导航链接
- 新增SMTP配置指南页面,提供SMTP配置说明(内容待补充)
- 在邮件管理页面添加指向指南页面的导航链接
- 配置路由权限,仅管理员可访问
2026-05-08 17:18:15 +08:00
yilv 3da47097ae style(admin): 优化邮件管理页面布局响应式设计
调整邮件管理页面的CSS布局,使用flex布局实现更好的响应式适配。
在桌面端采用水平排列,移动端自动切换为垂直排列,确保在不同屏幕尺寸下都能良好显示。
2026-05-08 17:13:50 +08:00
yilv a4e436a42d feat(登录): 添加忘记密码功能
- 新增忘记密码页面及路由配置
- 在登录页面添加忘记密码链接
- 添加中英文国际化支持
- 优化邮件管理页面的响应式布局
2026-05-08 17:06:52 +08:00
yilv ba480a3f9c fix: 修正获取用户列表时未正确处理API响应的问题 2026-05-08 16:58:26 +08:00
yilv f825303dd8 fix(admin): 修正邮件列表API路由路径
将用户邮件列表接口从 `/users/email-list` 移动到 `/admin/users/email-list` 路径下,确保路由层级与管理员权限管理保持一致。
2026-05-08 16:54:15 +08:00
yilv 1c5e424394 feat(邮件管理): 新增获取用户邮箱列表接口以优化收件人选择
- 后端新增 /admin/users/email-list 接口,专用于邮件发送的收件人下拉选择
- 前端在邮件管理页面改用新接口获取用户邮箱列表,提高数据获取效率
- 优化用户列表过滤逻辑,仅返回包含邮箱的用户信息
2026-05-08 16:50:24 +08:00
yilv 2a3e448a14 feat(邮件管理): 增加多收件人选择功能
- 将测试邮件收件人输入框改为多选下拉组件,支持选择用户或手动输入邮箱
- 添加用户列表加载功能,从管理API获取用户数据
- 移除单个邮箱验证规则,改为检查是否已选择收件人
- 发送测试邮件时支持多个收件人,邮件内容保持不变
2026-05-08 16:47:04 +08:00