feat: 增强 AI 配置与提示词管理,添加后端仓库删除/发布接口,优化响应式布局#84
Conversation
为订阅和查看GitHub按钮添加中文标题支持,根据当前语言环境显示相应文本
新增设置模块的多个面板组件,包括通用设置、WebDAV配置、备份恢复、分类管理、后端服务和AI配置。每个面板提供相应的功能界面和交互逻辑,支持多语言切换。 - 通用设置面板支持语言切换和版本检查 - WebDAV面板提供配置管理和测试功能 - 备份面板支持数据备份和恢复操作 - 分类面板管理自定义分类和默认分类显示 - 后端面板处理服务器连接和数据同步 - AI面板配置AI服务参数和测试连接
添加数据管理面板组件,支持查看数据统计和选择性删除不同类型的数据 包括仓库数据、发布信息、AI配置、WebDAV配置和分类设置 提供危险区域可删除所有数据,需GitHub用户名验证
- 新增侧边栏折叠状态管理,支持快捷键(Ctrl+B)切换 - 为移动端和桌面端分别优化侧边栏显示方式 - 添加返回顶部按钮组件,提升长页面浏览体验 - 更新相关状态管理以支持新功能
为多个按钮组件添加aria-label属性,确保屏幕阅读器能正确识别按钮功能。同时修复BackToTop组件初始可见状态和DataManagementPanel中存储清理的逻辑
添加移动端标签导航组件,支持平滑滚动和触摸滑动切换 引入滚动条隐藏和触摸优化样式类 重构设置面板的标签切换逻辑,添加过渡动画效果
- 实现仓库卡片的批量选择功能 - 添加批量操作工具栏支持取消Star、分类、AI总结和订阅 - 新增批量分类模态框 - 引入预设资源筛选器并支持重置 - 优化资源筛选器管理界面 - 添加动画效果增强用户体验
添加 README 模态框组件,支持点击仓库卡片空白区域查看仓库 README 内容 修复 GitHub API 返回的 base64 内容解码中文乱码问题 添加 rehype-raw 依赖以支持 HTML 标签渲染
refactor(AssetFilterManager): 使用预设常量重构默认筛选器 fix(BackToTop): 修复语言选择器状态获取方式 feat(RepositoryCard): 添加键盘操作支持与ARIA属性 perf(BulkActionToolbar): 优化确认超时处理逻辑 feat(SettingsPanel): 改进标签页切换动画与定时器管理 style(CategorySidebar): 调整移动端快捷键行为 feat(ReadmeModal): 增强图片错误处理与链接解析 refactor(RepositoryList): 优化批量操作错误处理与移动端布局 docs: 添加预设筛选器常量文档注释
refactor(RepositoryList): 提取选中仓库数组为统一变量 refactor(ReadmeModal): 重构Markdown链接处理逻辑 feat(CategorySidebar): 添加文字显示动画效果 fix(SettingsPanel): 修复移动端标签页指示器位置问题 feat(AssetFilterManager): 增加按钮可访问性属性 feat(ReleaseTimeline): 改进发布说明折叠和文件列表交互
移除SettingsPanel和CategorySidebar组件中的合并冲突标记
fix(AssetFilterManager): 为筛选按钮添加无障碍属性 feat(ReadmeModal): 引入rehype-sanitize插件增强安全性 refactor(ReleaseTimeline): 改进折叠按钮的无障碍支持 perf(RepositoryList): 优化批量AI分析流程 style(RepositoryCard): 调整选择模式下的交互逻辑 refactor(CategorySidebar): 优化分类拖放交互体验
修复 Markdown 代码块渲染逻辑,正确处理内联代码和代码块。优化侧边栏组件,使用 useRef 管理定时器并添加清理逻辑防止内存泄漏。同时改进仓库拖拽分类的错误处理,失败时恢复原始状态并提示用户。
- 在 AppState 中新增 categoryOrder 和 collapsedSidebarCategoryCount 字段 - 实现分类拖拽排序功能,支持上下移动、置顶置底操作 - 优化侧边栏折叠状态下的分类显示逻辑 - 新增退出多选模式时的卡片动画效果 - 改进批量操作工具栏的交互体验 - 更新持久化存储版本至 v2 并添加迁移逻辑
更新构建工作流中的 Node.js 版本以使用最新的 LTS 版本
refactor: 重构代码结构提升可维护性 fix: 修复分类排序和恢复备份的问题 perf: 优化动画性能减少卡顿 style: 统一按钮样式和交互体验 docs: 更新版本号显示逻辑 test: 增强错误处理和回滚机制 build: 添加 remark-breaks 依赖
添加Vite legacy插件支持旧版浏览器,引入polyfills和ErrorBoundary组件 优化分类管理功能,新增分类锁定/解锁操作,改进侧边栏交互体验 重构数据管理面板,确保状态重置时数据一致性 改进仓库列表性能,优化批量操作和筛选功能 添加滚动条样式和动画,提升用户体验
更新 acorn 到 8.16.0 版本 添加 @jridgewell/source-map、buffer-from、source-map、source-map-support 和 terser 依赖 移除 @types/prop-types 和 @types/react 的 dev 标记
refactor(Modal): 改进点击事件处理和样式过渡 refactor(ErrorBoundary): 增强错误处理和多语言支持 refactor(ReadmeModal): 优化数据获取逻辑和错误处理 refactor(BackendPanel): 改进后端连接检查逻辑 refactor(DataManagementPanel): 优化数据删除逻辑 refactor(CategoryPanel): 修复拖拽排序问题 refactor(AssetFilterManager): 优化筛选器重置逻辑 refactor(CategorySidebar): 改进分类计算逻辑 refactor(MarkdownRenderer): 增强代码块渲染和图片处理 refactor(SettingsPanel): 优化标签切换动画 refactor(webdavService): 改进错误处理和重试逻辑 refactor(githubApi): 增强类型定义和请求处理 refactor(useAppStore): 优化状态管理和数据迁移 refactor(categoryUtils): 重构分类计算逻辑 fix: 修复各种边界条件和潜在问题 fix(polyfills): 修正 CustomEvent 类型断言 fix(FilterModal): 移除未使用的图标导入 fix(indexedDbStorage): 导出 DB_NAME 常量 fix(updateService): 增强窗口打开安全性 fix(backendAdapter): 增加请求超时设置 fix(auth): 添加时序攻击防护注释 fix(Header): 移除未使用的图标导入 fix(types): 修正 Release 类型定义 fix(releases): 增强 ID 验证 fix(proxyService): 加强 URL 验证 fix(repositories): 增强数据验证 fix(AIConfigPanel): 修正推理努力设置 fix(Modal): 修复点击事件冒泡 fix(autoSync): 优化同步状态管理 fix(BackToTop): 优化过渡效果 fix(connection): 增强数据库初始化错误处理 fix(sync): 增强数据导入验证 fix(BackupPanel): 优化分类恢复逻辑 fix(GeneralPanel): 增强社交链接安全性 fix(tailwind): 优化动画配置 fix(index.css): 移除未使用的样式 fix(main): 增强错误回退处理 fix(MarkdownRenderer): 优化代码块渲染 fix(AssetFilterManager): 修复展开动画 fix(CategorySidebar): 优化分类计算 fix(ErrorBoundary): 增强错误处理 fix(ReadmeModal): 优化数据获取 fix(useAppStore): 修复数据迁移 fix(webdavService): 改进错误处理 chore: 更新依赖和配置 chore: 更新构建配置和依赖
refactor(RepositoryCard): 使用浅比较优化性能 fix(SearchBar): 修复输入法组合状态下的回车触发问题 feat(ReleaseCard): 添加源码下载链接支持 perf(CategorySidebar): 优化分类计数计算 fix(WebDAVService): 正确处理网络错误返回 feat(useAppStore): 添加仓库相关发布数据删除功能 style(index.css): 移除冗余样式属性 docs(BackupPanel): 更新备份描述文本 refactor(App): 使用React.memo优化视图渲染 perf(AIAnalysisOptimizer): 改进并发控制逻辑 feat(ReleaseTimeline): 添加刷新状态和分页控制
refactor(backend): 添加删除仓库和发布接口 fix(proxy): 改进API版本号兼容性处理 feat(db): 扩展分类和资产过滤器表结构 feat: 添加API类型定义文件 style(AIConfigPanel): 优化UI交互和提示词显示逻辑
- 为不同屏幕尺寸添加响应式布局和组件调整 - 在移动端添加折叠菜单和优化导航栏 - 调整仓库卡片网格布局以适应不同屏幕 - 更新AI搜索提示信息,明确说明使用本地算法 - 优化拖拽按钮在移动端的显示逻辑
📝 WalkthroughWalkthroughThe changes extend database schema with optional columns for categories and asset filters, introduce comprehensive API type definitions, implement DELETE routes for repositories and releases with transactional cleanup, update URL-building logic to handle existing version prefixes, enhance the header with responsive mobile navigation and state-driven text wrapping detection, improve the AI config panel with testing capabilities and prompt management, and adjust responsive layout breakpoints and styling across multiple UI components. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@server/src/routes/releases.ts`:
- Around line 182-185: The handler currently uses parseInt(req.params.id) which
accepts partial/decimal inputs; change the validation around the parse step in
the DELETE release route (the code using parseInt and req.params.id) to only
accept a strictly positive integer string (e.g. test req.params.id against a
/^\d+$/ pattern or verify String(req.params.id) ===
String(Number(req.params.id)) and Number.isInteger) before calling
parseInt/Number; if the check fails respond with 400 and code
'INVALID_RELEASE_ID' so inputs like "1abc" or "1.9" are rejected.
In `@server/src/routes/repositories.ts`:
- Around line 258-264: The transaction currently throws an Error when
repoResult.changes === 0 which causes the catch to map it to a 500; instead,
detect "not found" outside the transaction so you can return a 404. Change the
flow around deleteAll/db.transaction: have the transaction perform
deleteReleases.run(id) and deleteRepo.run(id) and return the repoResult (or
number of changes) from the transaction, then after the transaction completes
check the returned repoResult.changes (or changes count) and if it's 0 send a
404 with code REPOSITORY_NOT_FOUND; do the same adjustment for the other delete
block that uses deleteRepo/deleteReleases so not-found is handled outside the
transaction rather than by throwing inside it.
- Around line 248-251: The current parseInt(req.params.id) allows partial/float
inputs like "1abc" or "1.9" to become 1 — change validation to strictly accept
only positive integer strings (e.g. using a regex like /^\d+$/ or
Number.isInteger on the parsed value after confirming the string is all digits),
reject any non-matching req.params.id with the same 400/INVALID_REPOSITORY_ID
response, and only then convert the validated string to a Number to use as the
id in the delete transaction (ensure references to parseInt(req.params.id) and
the id variable in the delete handler/transaction are replaced with this
validated conversion).
In `@server/src/types/api.ts`:
- Around line 15-22: The DTO/row interface defines several properties as plain
string while the DB schema marks them nullable; update the interface fields
(topics, ai_summary, ai_tags, ai_platforms, analyzed_at, analysis_failed,
custom_description, custom_tags) to reflect DB nullability (use string | null
for nullable text columns and preserve number type for numeric columns but allow
null if schema marks them nullable), and apply the same fixes to the other row
interfaces referenced in the comment (the occurrences at the other locations
noted) so all shared row types match the schema nullability.
In `@src/components/Header.tsx`:
- Around line 177-217: The icon-only buttons (repositories, releases, settings)
render without accessible labels when isTextWrapped is true; update each
<button> that uses setCurrentView and icons (Search, Calendar, Settings) to
include an aria-label and title when isTextWrapped is true (e.g., use the
existing t('仓库','Repositories') / t('发布','Releases') / t('设置','Settings')
strings) so the icon-only fallback remains accessible and provides the same
localized label as the visible text.
In `@src/components/SearchBar.tsx`:
- Around line 803-820: The UI copy claims "Not actually calling LLM, uses local
intelligent ranking algorithm" but the search path in SearchBar.tsx still calls
aiService.searchRepositoriesWithReranking via handleAISearch when an active AI
config exists; either make the code truly local by removing/guarding calls to
aiService.searchRepositoriesWithReranking (use the local ranking function
instead) or update the copy and tooltip strings (the title and "关于AI搜索"/"This
feature..." text) to accurately state that the feature may call the configured
AI service when present; locate handleAISearch and
aiService.searchRepositoriesWithReranking to implement the chosen fix and update
the displayed text keys shown around the Bot and AlertCircle UI.
In `@src/components/settings/AIConfigPanel.tsx`:
- Around line 164-179: The test is using a fake id ('temp-test') so
AIService.requestText falls back to backend.proxyAIRequest when
backend.isAvailable && config.id, which can cause backend lookup of a saved
config instead of testing the current unsaved form; update the test flow in
AIConfigPanel.tsx to ensure testConnection uses the actual unsaved form values
by either (A) calling AIService.testConnection with a config that has no id
(remove or set id to undefined/null) so backend.proxyAIRequest is not triggered,
or (B) implement/route to a dedicated backend proxy that accepts the full temp
config payload; modify the code that constructs tempConfig (AIConfig) and the
AIService invocation (new AIService(tempConfig, language).testConnection()) so
backend.isAvailable && config.id does not resolve the request to a saved-config
lookup.
- Around line 42-45: The current showNotification in AIConfigPanel schedules a
new timeout each call which allows an older timer to clear a newer notification;
update showNotification to cancel any existing timer before creating a new one
by storing the timeout id in a ref (e.g., notificationTimerRef) and calling
clearTimeout(notificationTimerRef.current) prior to setTimeout, set
notificationTimerRef.current to the new id, and also clear the ref and timer on
component unmount (useEffect cleanup); reference the showNotification function,
setNotification state, and the new notificationTimerRef when making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3ef9594a-e163-4e87-a4b5-7b01d153bb76
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (13)
server/src/db/schema.tsserver/src/routes/proxy.tsserver/src/routes/releases.tsserver/src/routes/repositories.tsserver/src/types/api.tssrc/components/Header.tsxsrc/components/RepositoryCard.tsxsrc/components/RepositoryList.tsxsrc/components/SearchBar.tsxsrc/components/settings/AIConfigPanel.tsxsrc/index.csssrc/services/aiService.tssrc/services/backendAdapter.ts
✨ 新功能
AI 配置面板:添加测试连接功能,支持验证 AI 服务可用性
提示词管理:增强提示词编辑与显示逻辑,提升管理体验
后端接口:新增仓库删除和发布接口,完善资源管理能力
数据库:扩展分类表和资产过滤器表结构,支持更灵活的筛选
类型定义:添加 API 相关的 TypeScript 类型定义文件
🎨 样式与交互优化
响应式布局:改进移动端和桌面端的适配效果
移动端添加折叠菜单,优化导航栏交互
调整仓库卡片网格布局,自适应不同屏幕尺寸
优化拖拽按钮在移动端的显示逻辑
AI 搜索:更新提示信息,明确说明使用本地算法
AI 配置面板:优化 UI 交互和提示词展示方式
🐛 修复
代理兼容性:改进 API 版本号的兼容处理逻辑
♻️ 重构
后端:清理并添加删除仓库与发布相关接口代码
Summary by CodeRabbit
New Features
Improvements