54 Commits
Author SHA1 Message Date
EastonJiangandCursor 11f38624cd fix+perf: 绘图中文字体修复、进度自动跟踪、未验证配置刷爆日志 (#102)
* fix: 加固 Docker matplotlib 中文字体配置

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: 提前读取路径

* perf: 进度时间线与代码执行区自动跟踪最新消息

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: 未验证模型配置直接启动任务时无限重试刷爆日志

- 前端保存配置时始终推送到后端,不再依赖验证通过
- 后端 workflow 入口预校验四个 Agent 的 model/apiKey
- _validate_config 改抛 LLMConfigError 避免被 JSON 重试捕获
- coordinator/modeler 的 JSON 解析重试加上限 (MAX_JSON_RETRIES=3)

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 10:31:33 +08:00
Sanjin 4a360cbc7d add mathmodel skill (#93) 2026-06-05 20:18:25 +08:00
Celyn 9633ee1f7b feat(task): 添加任务停止运行功能 (#79)
- 后端:新增 POST /modeling/{task_id}/cancel 取消接口
- 后端:实现 asyncio.Event 取消机制,支持中断 LLM 调用
- 前端:任务详情页添加"停止运行"按钮
- 修复:取消后避免调用 md_2_docx 的错误
2026-05-18 10:41:32 +08:00
Guobin ZhangandGrey e9de237ea7 fix: matplotlib 中文方块——font_manager 旧缓存导致 SimHei 注册失效 (#74)
* fix: 透传 reasoning_content,修复 DeepSeek/MiMo thinking 模式下的 400 错误

API 开启 thinking 模式时,返回的 reasoning_content 必须在下一轮请求中原样
带回。当前代码丢弃了该字段,导致后续调用 100% 返回 400 错误,重试机制陷入
无限循环。修复内容:
- StandardResponse 新增 reasoning_content 字段
- OpenAIChatProvider 从响应中提取该字段
- 各 Agent 构建 assistant 消息时携带 reasoning_content
- agent.py 基类同时补上遗漏的 tool_calls 写入

* fix: matplotlib 中文方块问题——初始化脚本清除字体缓存 + prompt 增加 addfont 注册

- local/e2b interpreter: 注册字体前清除 matplotlib 字体缓存并重建 font_manager,
  回退链加入 macOS 系统中文字体 (Heiti SC, STHeiti, PingFang SC)
- coder prompt: sns.set_theme() 之前增加 font_manager.addfont() 步骤,
  确保 LLM 生成的每段代码主动注册字体,不依赖初始化脚本

* refactor: 精简字体修复——prompt 移除冗余 addfont,补充工程约束意识

- coder prompt 撤回 addfont 注册步骤(内核初始化已处理),避免重复 token 消耗
- modeler/coder prompt 新增:优化类问题的工程约束铁律(变量物理上下界、Q4 绳长限制)
- modeler/coder prompt 新增:EDA 按题型区分——机理题不做描述性统计

---------

Co-authored-by: Grey <grey@Greys-MacBook-Air.local>
2026-05-16 19:14:36 +08:00
Guobin ZhangandGrey 0e86335538 fix: 透传 reasoning_content,修复 DeepSeek/MiMo thinking 模式下的 400 错误 (#72)
API 开启 thinking 模式时,返回的 reasoning_content 必须在下一轮请求中原样
带回。当前代码丢弃了该字段,导致后续调用 100% 返回 400 错误,重试机制陷入
无限循环。修复内容:
- StandardResponse 新增 reasoning_content 字段
- OpenAIChatProvider 从响应中提取该字段
- 各 Agent 构建 assistant 消息时携带 reasoning_content
- agent.py 基类同时补上遗漏的 tool_calls 写入

Co-authored-by: Grey <grey@Greys-MacBook-Air.local>
2026-05-16 19:12:13 +08:00
Celynandxxxu680 12615b6639 chore(config): Update .gitignore and .env.example (#76)
- 简化 .gitignore 中的 DS_Store 规则,移除冗余配置
- 新增 dump.rdb 与 backend/.env.example 忽略规则
- 创建 backend/.env.example 示例配置文件

Co-authored-by: xxxu680 <109032617+xxxu680@users.noreply.github.com>
2026-05-16 19:11:02 +08:00
MuWinds ac57ad0c18 refactor: 重构 LLM Provider 模式、WebSocket 重连、图表字体跨平台兼容 (#70)
LLM 层重构:
- 将 LLM 调用层重构为 Provider 模式,支持多 API 类型
- 新增 Anthropic、OpenAI Chat、OpenAI Responses 三种 Provider
- 新增 LLM 类型定义和工厂类

WebSocket 重连:
- 添加指数退避自动重连机制(初始 1s,最大 30s,最多 10 次)
- 区分手动关闭与意外断开,仅意外断开触发重连
- 在任务页面顶部添加连接状态指示灯(绿/黄/红)

图表字体跨平台兼容:
- 在 backend/fonts/ 存放 SimHei 字体文件
- create_work_dir() 自动复制字体到任务工作目录
- 两个解释器从工作目录动态加载字体
- E2B 移除 apt-get install 依赖,改用上传字体文件
- 统一三处字体优先级配置

其他:
- 重构注释规范、修复类型错误、添加 lint hook
- 更新 CLAUDE.md 项目文档
2026-05-15 10:04:47 +08:00
Jiangming ZhongandClaude Opus 4.7 7b849c4a8f feat: 默认开启 RAG/HIL、修复类型问题、添加升级教程 (#69)
* feat: 新增 Web Search、RAG 知识库、HIL 人机协作、Feedback 容错机制

- Web Search: Tavily API 搜索互联网获取真实数据,注册为 search_web 工具
- RAG 知识库: ChromaDB + Rerank 检索建模方法、代码模板、论文写作参考
- HIL 人机协作: 关键节点暂停等待用户审批,支持 6 种决策动作
- 统一工具注册: tool_registry 替代 if/elif 硬编码分发
- Fallback Hand Off: 主 LLM 故障时自动切换备用模型,新建实例避免状态污染
- 有限重试: 所有 Agent 有明确重试上限,不再无限循环
- Evaluator Shadow Mode: 独立 LLM 评估输出质量,记录日志
- Feedback Rerun: 评估不通过时注入反馈重跑,先 Writer 后 Coder
- 双向 WebSocket: 客户端可发送决策消息到后端

* docs: 添加升级说明文档并更新 README 功能列表和后期计划

- UPGRADE2.md: Web Search + RAG 知识库 + HIL 人机协作升级说明
- UPGRADE3.md: Feedback Loop + Hand Off 容错机制升级说明
- README.md: 功能特性新增 4 项,后期计划标记 5 项已完成

* feat: 默认开启 RAG/HIL、修复类型问题、添加升级教程

- 默认开启 RAG_ENABLED=True 和 HIL_ENABLED=True,开箱即用
- 修复 response.py pyright 类型问题(msg_type override)
- 修复 knowledge_retriever.py ChromaDB metadata 类型转换
- 添加 升级说明.md 完整教程(Web Search / RAG / HIL / Fallback / Evaluator)
- 更新 README.md 添加新功能配置段落
- 预置所有功能配置到 .env.dev

* feat: 默认开启 RAG 和 HIL 功能

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat: 新增 Web Search、RAG 知识库、HIL 人机协作、Feedback 容错机制

- Web Search: Tavily API 搜索互联网获取真实数据,注册为 search_web 工具
- RAG 知识库: ChromaDB + Rerank 检索建模方法、代码模板、论文写作参考
- HIL 人机协作: 关键节点暂停等待用户审批,支持 6 种决策动作
- 统一工具注册: tool_registry 替代 if/elif 硬编码分发
- Fallback Hand Off: 主 LLM 故障时自动切换备用模型,新建实例避免状态污染
- 有限重试: 所有 Agent 有明确重试上限,不再无限循环
- Evaluator Shadow Mode: 独立 LLM 评估输出质量,记录日志
- Feedback Rerun: 评估不通过时注入反馈重跑,先 Writer 后 Coder
- 双向 WebSocket: 客户端可发送决策消息到后端

* docs: 添加升级说明文档并更新 README 功能列表和后期计划

- UPGRADE2.md: Web Search + RAG 知识库 + HIL 人机协作升级说明
- UPGRADE3.md: Feedback Loop + Hand Off 容错机制升级说明
- README.md: 功能特性新增 4 项,后期计划标记 5 项已完成

* feat: 默认开启 RAG/HIL、修复类型问题、添加升级教程

- 默认开启 RAG_ENABLED=True 和 HIL_ENABLED=True,开箱即用
- 修复 response.py pyright 类型问题(msg_type override)
- 修复 knowledge_retriever.py ChromaDB metadata 类型转换
- 添加 升级说明.md 完整教程(Web Search / RAG / HIL / Fallback / Evaluator)
- 更新 README.md 添加新功能配置段落
- 预置所有功能配置到 .env.dev

* Delete UPGRADE2.md

* Delete UPGRADE3.md

* fix: RAG 和 Web Search 改为默认关闭,减少用户配置负担

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:31:56 +08:00
Jiangming Zhong d5428a2a2e feat: 新增 Web Search 工具 + 统一 tool_registry 分发 (#68)
主要功能:
- Web Search: Tavily API 搜索互联网获取真实数据,注册为 search_web 工具
- 统一工具注册: tool_registry 替代 if/elif 硬编码分发
- Evidence 数据模型: DataEvidence 结构化搜索结果

编排层(workflow.py)集成:
- Web Search 初始化与动态工具注册
- RAG 知识库检索与注入
- HIL 人机协作检查点
- Fallback Hand Off 容错机制
- Evaluator + Feedback Rerun 质量保障

新增配置:TAVILY_API_KEY / SEARCH_ENABLED / SEARCH_CACHE_TTL
所有功能均有独立开关,未配置时行为与升级前一致。
2026-05-13 14:13:58 +08:00
MuWinds 5305754f0b refactor: 重构注释规范、修复类型错误、添加 lint hook 和 CLAUDE.md (#66)
- 后端按 Google Python Style Guide 重构注释,修复 ruff 和 pyright 错误(161→0)
- 前端按 Vue.js Style Guide 重构注释,修复 biome 错误
- 添加 PostToolUse lint hook(ruff + biome 自动检查)
- 更新 CLAUDE.md 覆盖 Commands/Testing/Structure/CodeStyle/GitWorkflow/Boundaries
- 修复 tsconfig.json 废弃的 baseUrl 配置
2026-05-11 23:02:39 +08:00
Sanjin c013bdae8a chore: 将 MAX_CHAT_TURNS 从 60 增加到 150 2026-05-01 16:51:49 +08:00
Sanjin 8136d30b05 fix: 移除不再使用的 DartNode 赞助链接
feat: 更新 matplotlib 字体设置以支持中文图表
2026-05-01 16:48:37 +08:00
Sanjin 1d80ea1766 Merge branch 'main' of https://github.com/jihe520/MathModelAgent 2026-05-01 16:45:56 +08:00
流年忆倾城andgrey c65a7eb92d fix: 刷新页面后恢复任务状态 (#58)
Co-authored-by: grey <grey@greydeMacBook-Air.local>
2026-04-30 23:18:41 +08:00
Sanjin aac34a1efd feat: 添加 OpenAlex API Key 支持并更新相关配置 2026-04-24 22:32:45 +08:00
SanjinandCopilot 64620eb17a 删除: 移除不再使用的环境配置文件 .env.dev
Co-authored-by: Copilot <copilot@github.com>
2026-04-24 22:32:38 +08:00
EastonJiang 3e8a0d6cac enhance: 重构 prompt 架构并注入竞赛级建模/可视化/写作规范 (#54)
* refactor: split prompts.py into prompts/ package

Break the monolithic prompts.py into a modular package with one file per
agent (coordinator, modeler, coder, writer) plus shared utilities.
All existing imports remain backward-compatible via __init__.py re-exports.

* enhance: 注入建模策略和可视化规范到 modeler/coder prompt

Modeler: 注入模型选择决策树、高分组合方案、建模方案质量要求、
可视化方案指南、EDA和敏感性分析规范。

Coder: 注入 O 奖级可视化标准(配色/去框/置信带)、数据预处理规范
(泄露防范/参数记录)、数据特征输出规范(每张图后 print 关键指标
供写作手引用)、结果汇总模板。

* enhance: 注入论文写作规范到 writer prompt

注入 MCM 论文结构规范(章节篇幅占比)、段落式写作要求(禁止正文
分点列表)、各章节写作要点(摘要四段式/假设需Justification/参数
需定量依据/因果vs相关区分)、图表引用规范(每图至少3行分析)、
敏感性分析写作骨架、过渡连接词和学术语态指南。

* fix: 强制 writer 在论文中插入 Markdown 图片标签

之前 writer 只写"如图X所示"文字描述,未插入 ![](filename.png)
导致 docx 转换后无图片。新增图片插入强制规范到 writer prompt,
同时改进 writer_agent 传递图片列表的格式,给出明确的插入模板。

* enhance: 增强鲁棒性并支持 per-agent max_tokens 配置

- modeler_agent: 新增 JSON repair 函数和重试机制,处理 LLM 返回
  的畸形 JSON(未转义引号、markdown 包裹等)
- flows: dict 取值改用 .get() 防止模型输出缺少键时 KeyError
- setting/llm/llm_factory: 新增 *_MAX_TOKENS 配置项,允许为每个
  agent 独立设置最大输出 token 数
- .env.dev: 模板中补充 MAX_TOKENS 注释字段
2026-03-18 23:35:36 +08:00
MuWinds 5d676366ad Fix: 重构CoderAgent中的重试逻辑,并在LLM中启用JSON模式验证 (#44)
* Fix: Refactor retry logic in CoderAgent and enable JSON schema validation in LLM

* Fix: Improve error handling in CoderAgent by logging failure messages instead of raising exceptions
2025-10-03 20:41:39 +08:00
Sanjin 7782c0c837 status (#38) 2025-09-14 17:08:55 +08:00
MuWinds 6f8fb0d495 Update:添加CoordinatorAgent运行方法中的错误处理和重试逻辑 (#37)
* Fix:RedisManager to handle connection errors during client initialization

* Update: Enhance error handling and retry logic in CoordinatorAgent's run method
2025-09-14 16:15:32 +08:00
MuWinds ad9f3b3443 Fix:RedisManager to handle connection errors during client initialization (#36) 2025-09-14 10:42:00 +08:00
Sanjin 49c5d6349a update readme , simplify config 2025-09-02 23:19:47 +08:00
Sanjin 22b46a36e4 简化配置
添加文件夹显示
2025-09-02 00:02:36 +08:00
Fan's Mac 3566a77622 mod ApiDialog.vue file,Add whitespace filtering: trim base URL and model ID, remove all spaces from API key 2025-08-31 22:29:48 +08:00
Sanjin 1921f9da0c feat: apikeydialog
add apikeydialog 在网页配置 apikey
不需要再环境变量
update docker file and github action
change prompt
跳过问题核验导致不非数学建模问题
2025-08-18 14:41:40 +08:00
Sanjin 57b7f55e78 fix bug
fix bug
2025-06-24 23:30:18 +08:00
Sanjin 25dfb5078f fix bug: tool_calls match tool response
fix bug: tool_calls match tool response
modify: the method of memory manage
add : timer
2025-06-24 00:26:57 +08:00
Sanjin 448807277a add
add
2025-06-16 19:56:32 +08:00
Sanjin d00e613d21 Merge branch 'main' into codex/修复拼写错误和代码问题 2025-06-06 14:28:26 +08:00
Sanjin 9e8b5d79c9 fix docs and interpreter, update tests 2025-06-06 14:25:40 +08:00
Sanjin 275585b2c7 Fix return type in interpreters and update tests 2025-06-06 14:21:23 +08:00
Sanjin 9149700e72 fix cite
fix cite
2025-06-03 19:00:02 +08:00
Sanjin 0deb7064ea cite fix
cite fix
2025-06-02 22:34:44 +08:00
Sanjin a6546272bc remove rethinking 2025-05-28 14:43:54 +08:00
Sanjin 4811d15b6d update 2025-05-28 13:17:35 +08:00
Sanjin 59634a7194 add docker
add docker
2025-05-27 15:12:29 +08:00
Sanjin 734747a522 modify prompt
modify prompt
2025-05-27 12:34:51 +08:00
Sanjin a1a6b010c3 modify
modify
2025-05-26 22:41:57 +08:00
Sanjin 5b928790ba fix
fix
2025-05-25 16:37:27 +08:00
Sanjin 31007b9713 backup 2025-05-24 14:24:38 +08:00
Sanjin f7db538240 bug fix 2025-05-24 13:44:08 +08:00
Sanjin 2595af63d3 add : modeler
add : modeler
2025-05-21 15:11:03 +08:00
Sanjin abb17af5a6 update
update
2025-05-19 20:31:56 +08:00
Sanjin db5f46987f modify
modify
2025-05-17 18:28:45 +08:00
Sanjin 56434a1c0a add search paper tool
add search paper tool
2025-05-15 14:21:39 +08:00
Sanjin 621402525c feat: add right paper cite
feat: add right paper cite
2025-05-14 08:44:53 +08:00
Sanjin 8d51aa0dc3 update 2025-05-12 14:45:37 +08:00
Sanjin ba3466c594 support all model
support all model
2025-05-12 13:30:41 +08:00
Sanjin eaa7c092e9 feat: index ,chat
add index page
add some examples in chat page
2025-05-10 14:47:32 +08:00
Sanjin 6cbaa3d7b8 add
add
2025-05-09 21:24:09 +08:00