Files
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

126 lines
2.8 KiB
TOML

[project]
name = "backend"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"aiofile>=3.9.0",
"aioredis>=2.0.1",
"ansi2html>=1.9.2",
"anthropic>=0.40.0",
"celery>=5.4.0",
"chromadb>=0.4.0",
"e2b-code-interpreter>=1.0.5",
"fastapi[standard]>=0.115.8",
"httpx[socks]>=0.28.1",
"icecream>=2.1.4",
"ipykernel>=6.29.5",
"jupyter-client>=8.6.3",
"loguru>=0.7.3",
"matplotlib>=3.10.1",
"nbformat>=5.10.4",
"numpy>=2.2.5",
"openai>=1.65.4",
"openpyxl>=3.1.5",
"pandas>=2.2.3",
"pydantic>=2.10.6",
"pydantic-settings>=2.8.0",
"pymupdf>=1.24.0",
"pypandoc-binary>=1.15",
"rank-bm25>=0.2.2",
"redis>=5.2.1",
"requests>=2.32.0",
"scikit-learn>=1.6.1",
"scipy>=1.15.2",
"seaborn>=0.13.2",
"semanticscholar>=0.10.0",
"sentence-transformers>=2.2.0",
"shap>=0.51.0",
"statsmodels>=0.14.4",
"uvicorn[standard]>=0.34.0",
"websocket>=0.2.1",
"xgboost>=3.0.0",
]
[dependency-groups]
dev = [
"ruff>=0.9.10",
]
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
# Same as Black.
line-length = 88
indent-width = 4
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F"]
ignore = []
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"