feat: 添加苏格拉底式预热系统和 AI 微评引擎#73
Open
zhangyapu1 wants to merge 8 commits into
Open
Conversation
- F-008: 调整为1-3问题簇模式(原单条问题) - F-001-B: 标注第4种微评类型列入V2.9规划 - F-007: 补充联网预热已集成web-search服务 - F-026/F-027: 标注与搜索功能列入V2.9规划 - 新增第7章:功能实现状态对照表 - 修订记录增加V2.8.1版本说明
- 删除F-027功能定义 - 更新补充说明,仅保留标注功能 - 更新功能实现状态对照表
Owner
|
你这个改动有点大,然后还有不少的测试代码,然后你截图看看你新增的功能 |
- 实现苏格拉底式预热对话系统,支持自动/智能/手动三种策略 - 开发AI微评生成引擎,支持hook/question/resonance/anecdote四种类型 - 添加完整的数据库迁移支持(v3-v9版本) - 集成预热状态管理和持久化存储功能 - 实现微评缓存机制和强制刷新功能 - 添加字数验证确保微评质量(≤65字符) - 增强设置持久化,添加迁移函数支持 - 创建预热对话框组件和自定义事件系统 - 完善错误处理和重试机制(15秒超时,1秒重试)
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.
🎯 概述
本 PR 引入了两个主要的 AI 驱动功能,以提升阅读体验:
✨ 新增功能
1. 苏格拉底式预热系统
三种预热策略
核心组件
PreheatingDialog.tsx:简洁友好的对话框,隐藏 AI 提示词SocraticReaderWrapper.tsx:管理预热状态和策略逻辑use-preheating.ts:预热工作流程的自定义 Hook实现细节
hasShownPreheatingDialog标志避免重复显示trigger-preheating)实现流畅的用户体验customPrompt参数发送)2. AI 微评引擎
核心功能
hook(引子)、question(问题)、resonance(共鸣)技术实现
book-mini-review.ts:主服务,包含缓存管理mini-review-queries.ts:数据库操作forceRefresh参数实现强制刷新机制缓存策略
3. 数据库迁移
添加了完整的迁移脚本(v3-v9)以确保正确的表结构:
mini_reviews表type和is_pinned列迁移在应用启动时通过
main.tsx自动运行。4. 设置持久化增强
增强了所有 store 以确保完全持久化:
settings-store.ts:为所有字段添加带默认值的迁移函数vector-model-store.ts:完整的迁移实现🔧 技术变更
新增文件
packages/app/src/components/chat/PreheatingDialog.tsxpackages/app/src/components/reader/SocraticReaderWrapper.tsxpackages/app/src/hooks/use-preheating.tspackages/app/src/lib/book-mini-review.tspackages/core/src/db/mini-review-queries.tstest-deepseek-api.js(API 连通性测试)修改的文件
packages/core/src/stores/settings-store.ts:添加hasShownPreheatingDialog和迁移packages/core/src/stores/vector-model-store.ts:添加迁移函数packages/app/src/lib/db/migrations.ts:添加 v3-v9 迁移packages/app/src/main.tsx:集成启动时的迁移packages/app/src/components/chat/ChatPanel.tsx:添加手动预热触发按钮packages/app/src/components/home/BookCard.tsx:更新超时和 forceRefresh 使用配置更新
🧪 测试
所有功能都已经过全面测试:
✅ 微评生成和缓存
✅ 字数验证(≤65 字符)
✅ 强制刷新机制
✅ 数据库迁移(v1-v9)
✅ 三种预热策略(自动/智能/手动)
✅ 跨重启的状态持久化
✅ 手动触发无弹窗刷新
✅ AI 提示词从 UI 隐藏
✅ 所有字段的设置持久化
📊 影响
🔄 兼容性
🚀 使用示例
微评生成
预热策略配置
🙏 说明