cjw 505f3591ab D17 批 2:算法接缝(OCC payload 通道 + hints 透传到分模评分)—— 闭环通
让批 1 沉淀的老师傅经验 hints 真接入分模方案生成:
processing_service 拉同指纹 hints 装进 OCC worker payload,
planner 透传到 candidate_generator(axis 优先级加成)和
scheme_scorer(score_breakdown 新字段 + total_score 加成),
写入即消费闭环通。

变更内容:
- src/moldinsight/core/parting_candidate_generator.py
  generate_candidates(..., hints=None):_build_axis_metrics 末尾按 hints
  加成(priority_score += weight × 20 上限;sample_count ≥ 2 + weight ≥ 0.5
  → method 标签升级 "human_experience_primary")
- src/moldinsight/core/parting_scheme_scorer.py
  score_schemes(schemes, *, hints=None) keyword-only:_score_scheme 新增
  human_hint_bonus 字段(weight × 12 上限;sample_count < 2 时 ×0.5 折半
  防信号不足过度影响);_compute_human_hint_bonus 静态方法解析 axis
  (parting.axis → axis → Z);bonus 纳入 total_score
- src/moldinsight/core/multi_scheme_planner.py
  generate_plan(..., hints=None):透传 hints 到 candidate_generator 与
  scheme_scorer;global_summary.applied_hints 注入返回供前端 ResultView
  渲染经验角标
- src/moldinsight/services/processing_service.py
  _step_generate_cavity 加 db_session 形参;调用
  experience_feedback_service.resolve_for_process_params 拿同指纹 hints,
  装进 run_occ payload 顶层 experience_hints;解析失败回退空 list
  不阻塞主流程(旧任务不因 receives 闭包退化)
- src/moldinsight/core/occ_worker.py
  _op_generate_cavity:payload.get("experience_hints") or {} 透传给
  planner.generate_plan(..., hints=...);普通 dict 跨进程 pickle 安全
  (满足 occ_worker.py:7-8 硬规则)
- tests/test_experience_feedback_algorithm.py(new)11 例:
  - candidate_generator 3 例(无 hints 默认 / hints 加成 / sample_count < 2 不升级)
  - scheme_scorer 4 例(无 hints 无 bonus / bonus 加成 / sample_count 折半 /
    weight=0 不加成)
  - multi_scheme_planner 2 例 OCC-gated(透传 / applied_hints 默认空)
  - processing_service 2 例 OCC-gated(payload 含 experience_hints /
    解析失败回退空 list)

设计取舍:
- keyword-only hints:避免与位置参数混淆
- weight 仅正向上有效:max(0, (adopted-rejected)/total),老师傅拒绝
  的不扣分老算法,只让采纳的加分
- signal-noise 控制:sample_count < 2 时 bonus ×0.5,但 priority_score
  仍加成(候选方向仍偏向,避免完全无信号)
- graceful degradation:hints 解析失败回退空 list,主流程继续

- docs/STATUS.md 顶部加 2026-09-23 批 2 日志条目
- docs/TECH_DEBT.md D17 追加批 2 已完成描述 + 缩减剩余工作(仅剩批 3 / 4)

测试基线:192 passed, 13 skipped(净增 7 通过 + 4 OCC-gated skip)。

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-23 16:21:33 +08:00
x
2026-05-21 14:25:14 +08:00
2026-02-12 23:27:42 +08:00
2026-02-12 23:27:42 +08:00
2026-05-29 18:19:30 +08:00
2026-08-27 14:53:22 +08:00
2026-09-16 17:55:04 +08:00
2026-03-07 03:04:15 +08:00
2026-02-12 23:17:53 +08:00
x
2026-07-20 10:16:27 +08:00
x
2026-05-14 16:56:18 +08:00
xxx
2026-07-30 10:30:50 +08:00
2026-09-16 17:55:04 +08:00
x
2026-07-31 15:57:13 +08:00
x
2026-06-01 13:51:16 +08:00
x
2026-05-14 16:56:18 +08:00
x
2026-06-01 13:51:16 +08:00

geMoldInsight

Version Python FastAPI Vue.js PostgreSQL License

geMoldInsight 是一个面向模具制造场景的综合系统,围绕 STEP/STP 模型分析、模具方案生成、分析结果沉淀、成品创建、BOM/库存/采购/销售闭环 展开。

当前实现状态:见 docs/STATUS.md 当前架构与边界:见 docs/ARCHITECTURE.md 本文是唯一文档导航入口:请按角色或主题跳转到对应主文档


项目概览

当前项目已经从早期单体演进为:

  • moldinsight 模块:模具分析、几何处理、批量分析、成本估算、结果导出
  • inventory 模块:产品、BOM、库存、采购、销售、财务
  • frontend 模块:Vue 3 前端工程
  • shared 平台层:配置、数据库、认证、日志、应用工厂

项目当前采用:

单仓库 + 单数据库 + 多模块 + 可独立部署

更详细的结构说明见 docs/ARCHITECTURE.md。


快速开始(三步)

1. 安装依赖

pip install -r requirements.txt

前端开发需要:

cd frontend
npm install

2. 配置环境变量

复制并编辑:

3. 启动

推荐先查看部署入口:

本地常见方式:

docker compose --profile full up -d

如需直接运行:

uvicorn src.entrypoints.moldinsight:app --reload --host 0.0.0.0 --port 8000
uvicorn src.entrypoints.inventory:app --reload --host 0.0.0.0 --port 8001

如需 OCC 几何分析能力,请准备 PythonOCC 运行环境。项目中通常通过 conda 提供,而不是仅靠 pip 安装。


目录概览

geMoldInsight/
├── src/
│   ├── entrypoints/               # 独立部署入口
│   ├── shared/                    # 当前共享平台层
│   ├── moldinsight/               # 模具分析模块
│   ├── inventory/                 # 进销存模块
│   ├── celery_app.py              # Celery app
│   └── celery_tasks.py            # moldinsight 异步任务
├── frontend/                      # 独立前端工程
├── migrations/                    # 数据库迁移
├── deploy/                        # 镜像、Nginx、部署辅助文件
├── docs/
├── tests/
├── requirements.txt
└── .env.example

文档导航(唯一入口)

按主题阅读

文档 解决什么问题
AGENTS.md 项目开发规范、硬约束、代码地图、文档同步要求
docs/STATUS.md 当前实现状态(日志体,唯一归属)
docs/ARCHITECTURE.md 当前架构、模块边界、结构原则
docs/OPERATIONS.md 配置 / 启动 / 环境 / 运维硬性要求
docs/API_CONTRACT.md 前后端契约:端点总览、约定、OpenAPI 类型生成
docs/ROADMAP.md 后续演进路线与阶段计划
docs/TECH_DEBT.md 当前活跃技术债与治理计划
docs/DEPLOYMENT.md 部署主题入口与部署文档分工
docs/deployment/LINUX_SETUP.md Linux 环境下的详细部署步骤
docs/archive/BACKEND_MODULARIZATION_BLUEPRINT.md 模块化蓝图档案与补充设计讨论

按角色阅读

你是 建议阅读顺序
第一次了解项目 本文 → docs/STATUS.md → docs/ARCHITECTURE.md
开发者 / 改代码 AGENTS.md → docs/ARCHITECTURE.md → docs/API_CONTRACT.md → docs/TECH_DEBT.md
运维 / 部署 本文 → docs/OPERATIONS.md → docs/DEPLOYMENT.md → docs/deployment/LINUX_SETUP.md
规划 / 重构 本文 → docs/ROADMAP.md → docs/TECH_DEBT.md

核心能力

模块 能力
moldinsight STEP/STP 上传、几何分析、特征识别、模具方案、批量分析、成本估算、结果导出
inventory 成品/物料、BOM、库存、库存流水、采购订单、销售订单、财务、采购建议
integration 分析结果一键创建成品,打通“模具分析 → 成品 → BOM → 销售/采购/库存”
platform 用户、角色、权限、JWT 鉴权、数据库连接、日志、健康检查

技术栈

后端

  • FastAPI
  • SQLAlchemy 2.0
  • PostgreSQL
  • Alembic
  • Redis
  • Celery
  • PythonOCC / trimesh / pyvista
  • RustFS / MinIO 兼容对象存储

前端

  • Vue 3
  • Vite
  • TypeScript
  • Pinia
  • Vue Router
  • TDesign Vue Next

基础设施

  • Docker / Docker Compose
  • 结构化日志 / request_id
  • OpenAPI → TypeScript 类型生成

当前代码入口


开发建议

  • 新增业务逻辑优先放入对应业务模块,不要继续堆进 shared
  • 新增 API 时优先考虑模块归属,而不是“能放就放”
  • 文档状态统一维护在 docs/STATUS.md
  • 部署方式变化统一更新 docs/DEPLOYMENT.md

许可证

本项目采用 MIT 许可证,详见 LICENSE。

S
Description
No description provided
Readme Apache-2.0 209 MiB
Languages
Python 67.3%
TypeScript 11.6%
Vue 11.3%
HTML 6.8%
CSS 2.5%
Other 0.5%