refactor: 优化代码结构,修复安全问题并提升性能#247
Open
xwang152-jack wants to merge 4 commits into
Open
Conversation
xwang152-jack
commented
May 23, 2026
- 新增dompurify依赖,净化Mermaid生成的SVG以修复XSS安全风险
- 替换各状态商店的全局计数器ID生成逻辑为crypto.randomUUID,避免ID冲突
- 将多处串行读取Markdown文件的逻辑改为并行处理,提升批量处理性能
- 配置Vite手动分包规则,拆分大依赖包优化页面加载速度
- 修复Clip服务器CORS配置,将通配符origin改为具体本地地址提升安全性
- 将全局lastQueryPages状态迁移至Chat Store,移除全局变量提升代码可维护性
- 为多处错误捕获添加调试日志,优化错误排查体验
- 将内容区域的视图组件改为懒加载,优化首屏加载性能
- 更新测试用例以适配新的ID生成格式
- 新增dompurify依赖,净化Mermaid生成的SVG以修复XSS安全风险 - 替换各状态商店的全局计数器ID生成逻辑为crypto.randomUUID,避免ID冲突 - 将多处串行读取Markdown文件的逻辑改为并行处理,提升批量处理性能 - 配置Vite手动分包规则,拆分大依赖包优化页面加载速度 - 修复Clip服务器CORS配置,将通配符origin改为具体本地地址提升安全性 - 将全局lastQueryPages状态迁移至Chat Store,移除全局变量提升代码可维护性 - 为多处错误捕获添加调试日志,优化错误排查体验 - 将内容区域的视图组件改为懒加载,优化首屏加载性能 - 更新测试用例以适配新的ID生成格式
- 新增retryAllFailed函数,支持批量重试当前项目所有失败的导入任务,并在活动面板添加对应按钮 - 修复本地嵌入服务调用时错误携带API密钥的问题,本地端点无需传递密钥 - 新增内容清洗逻辑,修复LLM生成的frontmatter缺少开头---的格式问题 - 重构docx文档提取代码,简化嵌套模式匹配,清理无用变量与废弃函数
Phase 1 - 核心管道质量: - Ingest 质量门控:Analysis 与 Generation 间插入校验,失败自动重试 - 文件夹批量分析:同目录文件合并为一次 LLM 分析,识别跨文件关联 - 搜索用户反馈回路:thumbs up/down 持久化,相关页面 +2 boost - 搜索历史持久化:最近 50 条,下拉建议 - 动态 Graph hop:密集图 1-hop,稀疏图 2-hop,0.3 阈值剪枝 Phase 2 - 知识图谱增强: - 社区结构反馈到检索:同社区 ×1.2 relevance bonus - Review 优先级排序:contradiction 90+ → suggestion 20 - 图谱时间快照:30 个快照 + 时间轴 UI + 增长统计 Phase 3 - Chat 智能化: - 引用校验:无效 [N] 标记自动去除 - 对话摘要压缩:超窗口自动 LLM 摘要,缓存避免重复调用 - Prompt 模板管理:4 个内置模板 + 自定义 + settings 面板 Phase 4 - 自动化: - 定期健康检查:孤立页/断链/空页/重复标题检测,结果写入 Review - 持续研究模式:定时执行 + LLM 对比差异,新发现创建 review item - 重试退避优化:指数退避 + permanently_failed 状态 Phase 5 - 协作与导出: - 静态站/PDF 导出:Markdown 站点导出 + Tauri print - Git 协作基础:init/status/commit/push/pull + settings 面板 Phase 6 - 用户体验: - 引导式 Onboarding:5 步引导,首次启动自动触发 - 设置预设:学术研究/日常笔记/团队知识库三套工作流预设
- 新增 ExportSection 组件,支持 Markdown 站点和 PDF 导出 - Settings 侧边栏添加导出分类入口 - 补充 en/zh 两套 i18n 翻译键
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.