Commit Graph

84 Commits

Author SHA1 Message Date
wonder 275e5cc886 docs: 添加 10 份技术文档,README 改为中文
- 01-architecture.md: 架构概览
- 02-backend-services.md: 后端服务层
- 03-frontend-interaction.md: 前端交互设计
- 04-database-design.md: 数据库设计
- 05-api-reference.md: API 接口文档
- 06-sse-streaming.md: SSE 流式传输
- 07-llm-integration.md: LLM 集成
- 08-deployment.md: 部署运维
- 09-development-guide.md: 开发指南
- 10-troubleshooting.md: 故障排查
2026-06-23 22:38:43 +08:00
wonder 6f0fabf934 refactor: 合并 AI 评审按钮到审查 Tab,移除重复入口
Deploy PR-Helper / deploy (push) Successful in 2m20s
- 移除 Diff 视图中的「🤖 AI 评审」按钮及行内进度/总结区域
- Review Tab 的「开始审查」现在具备行内 Diff 建议插入能力
- 合并 startInlineReview 到 startReview,统一 SSE 流和变量
- 移除独立的 review-diff-container,建议直接插入 Diff Tab 的 diff 视图
- 完成后 Review Tab 显示总结/备注/卡片,Diff Tab 显示行内建议
2026-06-23 22:10:35 +08:00
wonder 8e8ea6a07d refactor: 合并 PR 描述生成和 AI 代码审查到仓库详情页
Deploy PR-Helper / deploy (push) Successful in 2m9s
- 新增 PR 描述 tab:流式生成 + 双栏实时预览(渲染效果 + Markdown 源码)
- 新增 AI 代码审查 tab:Top-N/并发设置、历史记录、进度条、总结、备注、PDF 导出、内联 Diff
- 保留 Diff 视图中的 AI 评审快捷内联按钮
- Repo handler 传递 TopN/Concurrency 设置
- 删除独立的 generate.html 和 review.html 页面及路由
2026-06-23 21:55:05 +08:00
wonder 6dfd01445d refactor: 用 marked.js 替换手写 Markdown 渲染器
Deploy PR-Helper / deploy (push) Successful in 30s
- 引入 marked.js(~40KB)作为专业 Markdown 解析引擎
- markdown.js 精简为 20 行薄封装,保留 renderMarkdown 兼容别名
- CSS 从 .md-* 选择器改为标准 HTML 标签选择器
- 支持 GFM(表格、任务列表、删除线)、代码块语法高亮
- 天然处理流式不完整 Markdown(未闭合代码块等)
2026-06-21 16:23:14 +08:00
wonder 496e3ba71e refactor: LLM 直接输出 Markdown,移除 JSON 解析层
Deploy PR-Helper / deploy (push) Successful in 30s
服务端:
- prompt 改为要求直接输出 Markdown,不再输出 JSON
- GeneratePR 返回 string 而非 PRDescription 结构体
- 移除 JSON 解析、extractJSON、fixInlineCode 等逻辑
- ChatStream 的 content 事件直接携带 Markdown 片段流式传输

前端:
- generate() 仅处理 content + done + error 三个事件
- content 事件累积 Markdown 文本,实时渲染到两栏
- 移除 parsePartialJSON、buildMarkdown 等中间层
- 代码量从 ~100 行减至 ~50 行
2026-06-21 16:02:05 +08:00
wonder 779bd9e332 fix: 真正的流式输出 + 修复 Markdown 标题渲染
Deploy PR-Helper / deploy (push) Successful in 27s
流式输出:
- 恢复 content 事件处理,实时累积 LLM 原始输出
- parsePartialJSON 从不完整 JSON 中渐进提取已闭合的字段
- 每次提取到新字段即更新两栏,实现左栏渐进渲染
- 结构化事件(title/detail等)覆盖解析结果,确保最终一致

Markdown 渲染:
- 重写为逐行处理(_renderLines),不再按双换行分块
- ### 及更深层级标题在单换行后也能正确识别为独立块
- 列表项、水平线等同样受益于逐行解析
2026-06-21 15:57:54 +08:00
wonder cd1141d099 refactor: 流式输出直接写入两栏布局,移除独立流式区域
Deploy PR-Helper / deploy (push) Successful in 28s
- 左栏实时渲染 Markdown,右栏实时显示源码
- 每个 SSE 事件触发 updateColumns() 同时更新两栏
- 加载状态精简为标题旁的小 spinner + 状态文字
- 移除独立的 #streaming 区域和原始 LLM 文本展示
2026-06-21 15:53:28 +08:00
wonder 3455839213 fix: 左右两栏实时渲染、修复 HTTP 环境复制按钮
Deploy PR-Helper / deploy (push) Successful in 29s
- 生成过程中两栏布局始终可见,结构化字段实时更新
- 流式阶段显示在两栏上方,完成后仅隐藏流式指示器
- 复制功能增加 navigator.clipboard 存在性检查
- HTTP 环境降级为 textarea + execCommand fallback
2026-06-21 15:49:23 +08:00
wonder 41cf19ff61 feat: PR 生成页流式输出、左右两栏布局及按钮交互优化
Deploy PR-Helper / deploy (push) Successful in 29s
- 新增 content 事件处理器,实时显示 LLM 流式原始输出
- 按钮增加 opacity-70 和 cursor-not-allowed 视觉反馈
- 详细说明区域改为左右两栏:左侧渲染效果、右侧 Markdown 源码
- 流式阶段显示带自动滚动的内容区域,完成后切换为结构化展示
- 精简布局:移除独立 Markdown 预览区域,合并到两栏中
2026-06-21 15:43:02 +08:00
wonder 4a8e43e698 fix: 修复 PR 生成页 INLINECODE 显示及复制 Markdown 失败问题
Deploy PR-Helper / deploy (push) Successful in 26s
- 改进 LLM 提示词,明确要求用反引号包裹代码引用,避免输出 INLINECODE 占位符
- 后端新增 fixInlineCode 后处理,将残留 INLINECODE 占位符转为反引号代码
- 前端在 done 回调中从结构化字段组装完整 markdown 文本,修复复制按钮复制空内容
- 复制按钮增加空内容检查和错误提示
- Markdown 预览区域初始隐藏,生成完成后自动显示
2026-06-21 15:37:10 +08:00
wonder 2d3e306067 refactor: 优化审查进度条交互,file_start 和 file_end 均更新进度显示
Deploy PR-Helper / deploy (push) Successful in 26s
- file_start: 显示当前正在审查的文件名和已开始数量
- file_end: 更新进度条百分比和已完成数量
- 进度条仅在 file_end 时推进,文本在两个事件都更新,兼顾准确性和即时反馈
2026-06-21 15:22:49 +08:00
wonder c7b03303e4 fix: 修复代码审查进度条逻辑
Deploy PR-Helper / deploy (push) Successful in 28s
- 后端: file_start 事件改为在获取信号量之后发送,避免并发时所有文件同时'开始'导致进度瞬间跳到90%
- 前端: 进度追踪改为基于 file_end 事件(完成)而非 file_start(开始),进度条平滑反映实际审查进度
2026-06-21 15:17:51 +08:00
wonder 55bfdf08ce i18n: 中文化所有错误消息和用户交互文本
Deploy PR-Helper / deploy (push) Successful in 31s
- Go 后端 handler 错误消息统一中文化(middleware/repos/generate/review/settings)
- 前端 JS 加载和错误消息中文化(diff-viewer.js, graph.js)
- 模板页面错误 fallback 和静态文本中文化(index/generate/review/base)
- 消除中英文混杂,提升中文用户体验
2026-06-21 15:11:20 +08:00
wonder a6bd46db34 feat: support private repo cloning with HTTP basic auth
Deploy PR-Helper / deploy (push) Successful in 30s
- Add SSH URL detection with friendly prompt to use HTTPS instead
- Add private repo toggle (default off) with username/password fields
- Persist auth_type and credential in repositories table
- Pass stored credentials to PullRepo for authenticated pulls
- Incremental migration adds auth_type and credential columns
2026-06-21 14:58:12 +08:00
wonder 82666cff26 refactor: remove inline branch/tag labels, keep only top-right legend
Deploy PR-Helper / deploy (push) Successful in 29s
2026-06-21 14:45:50 +08:00
wonder 9b26bcb1b8 feat: move git graph legend to top-right corner to avoid overlap with graph
Deploy PR-Helper / deploy (push) Successful in 26s
2026-06-21 14:43:16 +08:00
wonder 1359c5c339 fix: use MySQL-compatible datetime format for cloned_at
Deploy PR-Helper / deploy (push) Successful in 22s
RFC3339 format (T separator, Z suffix) is rejected by MySQL DATETIME columns.
Use '2006-01-02 15:04:05' instead.
2026-06-21 14:39:36 +08:00
wonder 18e50c78d5 ci: revert to secrets.DEPLOY_ENV, variables context not supported in Gitea Actions
Deploy PR-Helper / deploy (push) Successful in 29s
2026-06-21 14:35:32 +08:00
wonder 1cd4aa899a ci: add debug output for .env content to troubleshoot multiline variable
Deploy PR-Helper / deploy (push) Successful in 25s
2026-06-21 14:34:24 +08:00
wonder 20be99b287 feat: add git pull to update cached repositories from remote
Deploy PR-Helper / deploy (push) Successful in 34s
- Replace dead FetchRemote with PullRepo (fetch + merge) in services/git.go
- Add POST /api/repos/:id/pull endpoint with DB size/last_used update
- Add '更新' button next to each cached repo in the index page
2026-06-21 14:31:33 +08:00
wonder 25291a81a3 fix: use variables instead of secrets to reference repository-level variable 2026-06-21 14:31:09 +08:00
wonder 846288731f perf: add BuildKit cache mounts to speed up Go build in Docker
Deploy PR-Helper / deploy (push) Successful in 3m28s
Mount persistent cache for go build and module directories so
subsequent builds only recompile changed packages.
2026-06-21 14:20:34 +08:00
wonder 64098a92d3 fix: change default external port from 8080 to 8081 to avoid conflict with slides-nginx
Deploy PR-Helper / deploy (push) Successful in 3m11s
2026-06-21 14:05:22 +08:00
wonder 05fb1678de ci: simplify deploy workflow with Alpine container and Gitea checkout
Deploy PR-Helper / deploy (push) Failing after 4m17s
2026-06-21 00:25:15 +08:00
wonder e83afb5fb0 fix: install docker.io and docker-compose-plugin in job container 2026-06-21 00:08:59 +08:00
wonder 8a3f14eb1b fix: remove ineffective container.options, rely on runner volume mounts 2026-06-21 00:04:33 +08:00
wonder 91a18e76a5 fix: install Docker CLI in job container and mount docker.sock 2026-06-21 00:01:53 +08:00
wonder 47f0ef9fb9 fix: revert container.options, rely on runner volume mount for host directory access 2026-06-20 23:59:23 +08:00
wonder f278908526 fix: use container.options volume mount for host directory access in deploy workflow 2026-06-20 23:56:00 +08:00
wonder fc1e564628 ci: add Gitea Actions workflow for auto deploy on push to main
Deploy PR-Helper / deploy (push) Failing after 0s
2026-06-20 23:32:43 +08:00
wonder 735126ff56 fix: escape 'key' as reserved word in all MySQL queries with backticks 2026-06-20 23:21:24 +08:00
wonder 99fb89c60d fix: use PORT env var for external port mapping, hardcode internal port to 8080 2026-06-20 23:16:11 +08:00
wonder ca2e294735 feat: add git pull as first deploy step, remove embedded MySQL wait logic 2026-06-20 23:09:48 +08:00
wonder 4d04153d61 refactor: remove embedded MySQL from docker-compose, use external data source 2026-06-20 23:08:10 +08:00
wonder 65e0b26d8d refactor: remove GOPROXY injection logic from deploy.sh, already in Dockerfile 2026-06-20 22:59:44 +08:00
wonder 1a64b2e98e fix: add GOPROXY=https://goproxy.cn,direct to Dockerfile 2026-06-20 22:58:41 +08:00
wonder 9bfe1ec120 fix: upgrade Docker base image to golang:1.25-alpine for go.mod compatibility 2026-06-20 22:57:08 +08:00
wonder 6652cd2b88 fix: deploy.sh uses PORT from .env exclusively, remove CLI port argument 2026-06-20 22:55:52 +08:00
wonder be7ce2a385 fix: deploy.sh reads MySQL config from .env instead of generating it
- Error out if .env is missing, instruct user to copy from .env.example
- Source .env to load MYSQL_* variables for docker compose
- Command-line port argument overrides PORT in .env
2026-06-20 22:53:48 +08:00
wonder 95519963c3 fix: update deploy.sh to generate .env with MySQL configuration
- Generate .env with random MySQL password on first deploy
- Update PORT in .env instead of modifying docker-compose.yml directly
- Wait for MySQL container healthcheck before checking app status
- Skip .env generation if file already exists
2026-06-20 22:52:27 +08:00
wonder 00c1839635 feat: migrate database from SQLite to MySQL with .env configuration
- Replace go-sqlite3 with go-sql-driver/mysql (pure Go, no CGO needed)
- Add joho/godotenv for .env file loading
- Rewrite database/db.go with MySQL-compatible DDL (BIGINT AUTO_INCREMENT, InnoDB, utf8mb4)
- Convert all SQLite-specific SQL: INSERT OR IGNORE → INSERT IGNORE,
  INSERT OR REPLACE → INSERT ... ON DUPLICATE KEY UPDATE,
  datetime('now') → NOW(), date arithmetic → DATE_SUB()
- Add MySQL config fields to config.go (host/port/user/password/database)
- Add .env.example with connection parameter template
- Update Dockerfile: remove CGO/gcc/musl dependency, smaller build
- Update docker-compose.yml: add MySQL service container with healthcheck
- Update CLAUDE.md documentation
2026-06-20 22:40:46 +08:00
wonder 6c60b767df refactor: replace chromedp with browser native print for PDF export
Remove chromedp dependency, use window.print() instead. Docker image no longer needs Chromium (~200MB smaller).

- Delete services/pdf.go and templates/reports/review.html

- Remove PDF API route POST /api/repos/:id/review/pdf

- Add @media print CSS to review page

- Remove chromium from Dockerfile
2026-06-20 22:26:46 +08:00
wonder 37aa9c0a33 fix: 结构化渲染审查总结,替换原始JSON显示
- 后端发送结构化数据(score/overall/findings/recommendations)而非格式化文本
- 增加灵活JSON解析,兼容LLM返回recommendations为数组的情况
- 前端渲染带样式的审查总结:评分徽章(颜色分级)、分区展示
- 两个页面统一处理:repo页面的内联审查和review页面的完整审查
2026-06-20 22:15:00 +08:00
wonder 292588ef23 feat: 将默认 LLM 配置从 OpenAI 切换为 DeepSeek (deepseek-v4-pro) 2026-06-20 22:03:09 +08:00
wonder 9c843b79ba feat: 添加用户注册登录功能,实现数据和配置的用户隔离
- 新增 users 和 user_settings 表,repositories/analyses/review_notes 添加 user_id 列
- 实现基于邮箱+密码的注册登录,密码使用 bcrypt 哈希
- 使用 gin-contrib/sessions cookie-based session 管理
- 所有仓库、分析记录、review notes 按用户隔离
- 用户设置(LLM 配置、review 参数、缓存配置)独立存储
- 新增登录/注册页面,导航栏显示用户邮箱和退出按钮
- 前端 fetch 请求统一添加 credentials: 'same-origin'
- 支持 SESSION_SECRET 环境变量配置会话密钥
2026-06-20 21:57:46 +08:00
wonder 953c83d9aa feat: 添加一键部署脚本(国内镜像加速) 2026-06-20 17:44:48 +08:00
wonder 87bb23e19e docs: 删除 PLAN.md,更新 CLAUDE.md 中的引用
PLAN.md 的内容已被 CLAUDE.md、README.md 和代码覆盖:
- API 路由、功能描述、Docker 配置 → README.md
- 架构、关键模式、目录结构 → CLAUDE.md
- SQL Schema、LLM Prompts、SSE 格式 → 代码本身

更新 CLAUDE.md Development Notes,将 PLAN.md 引用改为指向实际代码文件。
2026-06-20 17:34:57 +08:00
wonder e571a33dd2 docs: 重写 README,添加安装配置和 API 参考文档 2026-06-20 00:06:17 +08:00
wonder 446bb987f4 feat: 添加 Docker 部署配置 2026-06-20 00:06:10 +08:00
wonder 6efba13d7d feat: 优雅关闭与模板错误检查 2026-06-20 00:06:08 +08:00