Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9b250b8
fix: 修复主题订阅 schedule_frequency 缺失和日期过滤全链路未连通问题
Color2333 Mar 11, 2026
a9d12be
refactor(docs): 整理项目文档结构
Color2333 Mar 11, 2026
744df84
refactor(config): 统一环境变量配置
Color2333 Mar 11, 2026
cbc4d5d
refactor(docker): 清理冗余Docker配置
Color2333 Mar 11, 2026
47913d3
refactor(structure): 整理项目目录结构
Color2333 Mar 11, 2026
3199f96
chore: 清理根目录构建产物和冗余文件
Color2333 Mar 11, 2026
057eb82
feat(scripts): 添加开发环境一键初始化脚本
Color2333 Mar 11, 2026
08bd106
chore: 更新 .gitignore
Color2333 Mar 11, 2026
e45bc77
docs: 更新README适配新的项目结构
Color2333 Mar 11, 2026
9380dc7
fix: 更新.gitignore,忽略整个data目录
Color2333 Mar 11, 2026
749ddcf
fix(security): 修复认证安全漏洞 - JWT默认密钥/明文密码比较/OPTIONS放行
Color2333 Mar 11, 2026
7c59aff
fix(frontend): 修复SSE解析/闭包泄漏/唯一ID/localStorage溢出
Color2333 Mar 11, 2026
ab8b29d
fix(frontend): 修复401自动登出/后端等待超时/React类型版本/退出按钮
Color2333 Mar 11, 2026
9600da5
fix(backend): 修复TTLCache无上限和docker-compose无效env引用
Color2333 Mar 11, 2026
84295e8
fix(frontend): 修复Topics页面预先存在的语法错误
Color2333 Mar 11, 2026
3036140
refactor(types): 统一前端类型定义 - 15个interface从api.ts迁移至types/index.ts
Color2333 Mar 11, 2026
6725ceb
chore: 统一代码著作权标识 @author Bamzc → Color2333
Color2333 Mar 11, 2026
6048d3a
fix(agent): 修复Agent对话系统核心问题
Color2333 Mar 11, 2026
cf80d9d
chore: 配置代码格式化工具链
Color2333 Mar 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 44 additions & 45 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,58 +1,81 @@
# ==========================================
# PaperMind 环境配置示例
# ==========================================
#
# 使用说明:
# - 本地开发:复制为 .env(根目录)
# - Docker部署:复制为 .env(根目录)
#
# 必须配置项:至少填写一个 LLM API Key
# ==========================================

# ==========================================
# 基础配置
# ==========================================
APP_ENV=production
APP_NAME=PaperMind API
API_HOST=0.0.0.0
API_PORT=8000

# 数据库路径
# - 本地开发:sqlite:///./data/papermind.db
# - Docker部署:sqlite:////app/data/papermind.db
DATABASE_URL=sqlite:///./data/papermind.db

# 存储路径
PDF_STORAGE_ROOT=./data/papers
BRIEF_OUTPUT_ROOT=./data/briefs
SKIM_SCORE_THRESHOLD=0.65
# 北京时间 05:00 执行每日任务(UTC 21:00)
DAILY_CRON=0 21 * * *
# 北京时间周日 06:00 执行每周图谱维护(UTC 22:00)
WEEKLY_CRON=0 22 * * 0
# Docker 部署: 用 * 允许所有来源,或填写实际域名

# CORS 配置
# - 本地开发:*
# - Docker部署:http://localhost:3002,http://127.0.0.1:3002
CORS_ALLOW_ORIGINS=*

# ==========================================
# LLM API 配置(必须填写至少一个!)
# ==========================================
# LLM Provider: openai / anthropic / zhipu
LLM_PROVIDER=zhipu

# OpenAI
# OpenAI(可选)
OPENAI_API_KEY=
# Anthropic

# Anthropic(可选)
ANTHROPIC_API_KEY=
# ZhipuAI (智谱)

# ZhipuAI 智谱(推荐,便宜)
ZHIPU_API_KEY=

# 外部 API
SEMANTIC_SCHOLAR_API_KEY=
# OpenAlex(高速率引用源,填邮箱即可获得 10 req/s 免费配额)
OPENALEX_EMAIL=

# 模型配置
LLM_MODEL_SKIM=glm-4.7
LLM_MODEL_DEEP=glm-4.7
LLM_MODEL_VISION=glm-4.6v
LLM_MODEL_FALLBACK=glm-4.7
EMBEDDING_MODEL=embedding-3

# ==========================================
# 成本管控
# ==========================================
COST_GUARD_ENABLED=true
PER_CALL_BUDGET_USD=0.05
DAILY_BUDGET_USD=2.0
SKIM_SCORE_THRESHOLD=0.65

# ==========================================
# 站点认证配置
# ==========================================

# 站点密码,为空则禁用认证(公开访问)
# 设置后将要求输入密码才能访问系统
AUTH_PASSWORD=

# JWT 密钥(用于签名 token)
# 生产环境请修改为随机字符串
# JWT 密钥(生产环境请修改为随机字符串)
AUTH_SECRET_KEY=papermind-secret-key-change-in-production

# ==========================================
# SMTP 邮件配置
# SMTP 邮件配置(推送通知需要)
# ==========================================
SMTP_HOST=
SMTP_PORT=587
Expand All @@ -62,59 +85,35 @@ SMTP_FROM=
NOTIFY_DEFAULT_TO=

# ==========================================
# 智能调度配置 - UTC 时间(推荐
# 智能调度配置UTC 时间)
# ==========================================

# 每日简报时间(UTC 时间)
# 推荐:0 4 * * * (UTC 4 点 = 北京时间 12 点,午饭时间)
# 说明:预留 2 小时处理缓冲
# 02:00 主题抓取 → 02:00-04:00 并行处理 → 04:00 生成简报
# 每日简报:UTC 4 点 = 北京时间 12 点
DAILY_CRON=0 4 * * *

# 每周图谱维护(UTC 时间)
# 推荐:0 22 * * 0 (UTC 周日 22 点 = 北京时间周一 6 点)
# 每周图谱:UTC 周日 22 点 = 北京时间周一 6 点
WEEKLY_CRON=0 22 * * 0

# 主题抓取默认时间(UTC 小时,0-23)
# 推荐:2 (UTC 2 点 = 北京时间 10 点)
DEFAULT_TOPIC_TIME_UTC=2

# 精读配额配置(每个主题每次最多精读篇数)
# 推荐:20 篇抓取 → 精读 1-3 篇(节省 LLM 费用)
# 精读配额(每个主题每次最多精读篇数,省钱!)
DEFAULT_MAX_DEEP_READS=2

# ==========================================
# 闲时自动处理器配置
# ==========================================

# 是否启用闲时自动处理(true/false)
# 功能:系统空闲时自动批量处理未读论文(只粗读 + 嵌入,不精读)
# 系统空闲时自动批量处理未读论文(只粗读 + 嵌入,不精读)
IDLE_PROCESSOR_ENABLED=true

# 闲时批次处理数量(每次处理几篇)
# 推荐:5-10 篇(避免影响正常用户请求)
IDLE_BATCH_SIZE=5

# 空闲检测间隔(秒)
# 推荐:60 秒(每分钟检测一次)
IDLE_CHECK_INTERVAL=60

# 系统空闲阈值(用于闲时检测)
# CPU 使用率低于此值才认为是空闲
# 空闲阈值
IDLE_CPU_THRESHOLD=30.0

# 内存使用率低于此值才认为是空闲
IDLE_MEMORY_THRESHOLD=70.0

# API 请求数低于此值才认为是空闲(请求数/分钟)
IDLE_REQUEST_THRESHOLD=5

# ==========================================
# Worker 重试配置
# ==========================================

# 任务失败最大重试次数
WORKER_RETRY_MAX=3

# 重试基础延迟(秒),使用指数退避
WORKER_RETRY_BASE_DELAY=5.0
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ htmlcov/
.claude/
CLAUDE.md
.spec-workflow/
.cursor/

# Data (runtime generated)
data/
# Logs
logs/
*.log

# Node / Frontend
node_modules/
Expand All @@ -46,14 +50,11 @@ frontend/dist/
package-lock.json
frontend/package-lock.json

# Egg info
papermind.egg-info/

# Tauri / Desktop build
src-tauri/target/
src-tauri/binaries/
*.dmg
*.app

# Docker deploy data (runtime)
deploy/
# PyInstaller
*.spec
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# PaperMind Pre-commit Hooks
# 安装: pre-commit install
# 手动运行: pre-commit run --all-files

repos:
# Python - Ruff (格式化 + Lint)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

# TypeScript/JavaScript - Prettier
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.4.2
hooks:
- id: prettier
files: \.(ts|tsx|js|jsx|json|css|md)$
exclude: ^frontend/node_modules/

# 通用检查
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: ^frontend/node_modules/
- id: end-of-file-fixer
exclude: ^frontend/node_modules/
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: check-added-large-files
args: [--maxkb=500]
Loading