diff --git a/README.en.md b/README.en.md index 5c693d8f..e26ecfbe 100644 --- a/README.en.md +++ b/README.en.md @@ -157,6 +157,7 @@ Practice statistics show total practice, accuracy (correct / attempted) and acti - **∑ LaTeX formulas**: formulas in questions, answers and analyses are rendered with KaTeX, supporting `$…$`, `$$…$$`, `\(…\)` and `\[…\]`; switch between source and preview while editing. When a formula has syntax errors, a **Fix LaTeX** button appears and AI fixes only the formula syntax. - **📝 Regenerate the solution**: **Regenerate full solution** on the details page asks AI to rewrite the answer and analysis (with confirmation before overwriting); knowledge points and the cause of the mistake stay unchanged. - **🧭 Question-type-specific explanations (preview)**: when you regenerate a solution, the app loads a teaching pattern for the recognized subject and question type. The first pilot covers math calculations, math solutions and English reading comprehension; unmatched cases fall back to the general rules. +- **🏷️ Custom question types**: Settings → General → Question types adds custom types (Chinese name, optional English name, AI instructions) with rename, deactivate, reactivate and delete. Active types appear in recognition, regeneration, re-tagging, question filters, exam creation, exam grouping and import drafts; AI classifies by name and instructions while built-in types stay unchanged. Deactivating or deleting only removes future options and old questions keep their key; backups preserve custom types from format version 24. - **🖼️ Question figures**: during recognition AI first locates the figure, then crops that area and redraws it as SVG in a separate request (listing every line, arrow and label before drawing, and checking that the SVG is valid). For a saved mistake with a figure, set **Figure display scale** (10–200%, default 100%) and **Figure alignment** (left / center / right, default center) on its details page; exam papers with figures also support adjusting the scale and alignment per question or uniformly across the exam. Saved settings apply to display and printouts and are restored from backups. Regenerating a figure first opens the original photo for framing the figure area, so only that area goes to AI and a small figure in a full-page photo does not lose resolution; you can also rotate before framing. - **🧩 Original figure**: recognition also saves the cropped original figure. For chemical structures and complex diagrams that AI may redraw inaccurately, switch **Figure source** to Original on the details page to show the exact cropped image; when the original is unclear, upload or paste a clearer screenshot from another tutoring app (source **Uploaded**), and switch between all three sources anytime; simple geometry stays clearer with AI redraw. Exam questions keep a copy of the source question's cropped and uploaded figures. You can switch between Original / AI redraw / Uploaded in exam details and print preview. Backups preserve original figures on notebook questions from format version 17, exam figure snapshots from version 19, the mobile navigation choice from version 20 and uploaded figures from version 21, and analysis figures from version 22. - **📐 Analysis figure**: When an analysis needs auxiliary lines, geometry constructions or diagrams, **Generate analysis figure** on the details page asks AI whether a figure is needed and draws it as SVG; it appears under the analysis and in question printouts. When no figure is needed, the button clears the existing analysis figure. An existing question figure is used as the drawing base, so only the auxiliary lines and labels added by the analysis are drawn. diff --git a/README.md b/README.md index 75c50016..f04fddc7 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,7 @@ - **∑ LaTeX 公式**:题目、答案和解析中的公式用 KaTeX 显示,支持 `$…$`、`$$…$$`、`\(…\)`、`\[…\]`;编辑时可在「源代码 / 预览」之间切换。检测到公式语法错误时,详情页出现「修复 LaTeX」按钮,由 AI 只修复公式写法。 - **📝 重新生成解答**:详情页「重新生成完整解答」由 AI 重新生成答案和解析(覆盖前二次确认),知识点和错因保持不变。 - **🧭 题型专属讲解(预览版)**:重新生成解答时,系统会根据已识别的学科和题型加载对应的讲解范式;当前覆盖数学计算题、数学解答题和英语阅读理解,未命中时自动使用通用规则。 +- **🏷️ 自定义题型**:设置 → 通用 → 题型管理可新增自定义题型(中文名、可选英文名、AI 讲解说明),支持改名、停用、启用和删除。启用后出现在识别、重解、重标注、错题筛选、组卷、试卷分组与导入草稿的题型选项中;AI 按名称和说明判断题型,内置题型保持不变。停用或删除只影响后续选项,旧题仍显示原 key;题型从备份第 24 版起随导出导入还原。 - **🖼️ 题目配图**:识别时 AI 先定位配图,再把配图区域裁剪出来单独用 SVG 重绘(先逐项列出线段、箭头和标注再作图,生成后校验 SVG 是否合法);有配图的错题可在详情页设置「配图显示比例」(10%~200%,默认 100%)与「配图显示位置」(居左/居中/居右,默认居中),含配图的试卷也支持按题逐个调整或全卷统一调整配图比例与显示位置,保存后同步用于显示和打印,并随备份恢复。拍照原图可在「查看原题图片」中核对,也可替换或补充上传。重绘配图时先打开原图框选配图区域,只把该区域交给 AI,避免整张照片中的小配图因分辨率不足而失真;也可旋转后再框选。 - **🧩 配图原图**:识别时会同时保存裁剪出的原配图;化学结构式、复杂示意图等 AI 难以重绘准确的图形,可在详情页把配图来源切换为「原图」,与拍照原图完全一致;原图不清晰时还可上传或粘贴辅导 App 截图等清晰配图(来源「上传配图」),三种来源随时切换;简单几何图继续用「AI 重绘」更清晰。试卷会保留来源错题的裁剪原配图与上传配图,试卷详情和打印预览都可切换「原图 / AI 重绘 / 上传配图」。错题原配图从备份第 17 版起保存,试卷的原图与来源快照从第 19 版起保存,手机底栏入口偏好从第 20 版起保存,上传配图从第 21 版起保存,解析配图从第 22 版起保存。 - **📐 解析配图**:解析需要辅助线、几何构造或示意图时,详情页「生成解析配图」由 AI 判断解析是否用图并生成 SVG,显示在解析下方、随错题打印一并输出;解析不需要配图时按钮会清空已有解析配图。已有题目配图会作为绘制基础,只补充解析新增的辅助线与标注。 diff --git a/doc/wiki/Backup-and-Restore.md b/doc/wiki/Backup-and-Restore.md index 38676110..d7db6a0d 100644 --- a/doc/wiki/Backup-and-Restore.md +++ b/doc/wiki/Backup-and-Restore.md @@ -33,7 +33,7 @@ 错题的配图、GeoGebra 演示、中英文 SVG 动画讲解及其已合成的云端语音(MP3)、最近一次举一反三和掌握概率都会随导出文件还原,SVG 在导入时重新净化;没有掌握概率的题目导入后会重新评估。试卷连同题目和每次录入的结果一起还原;导出时仍在生成的题目导入后显示为失败,可在试卷页重新生成。导入本人的导出文件时,还会还原录入年级识别规则及固定年级、导入前人工校对、判重阈值、GeoGebra 演示、SVG 动画讲解和界面主题等偏好设置。 -导出文件为第 23 版:试卷题目新增 `bankQuestionId`(真题库来源题目 ID 快照);第 22 版错题新增 `analysisFigureSvg`(AI 生成的解析配图);第 21 版错题与试卷题目新增 `figureUploadImage`(用户手动上传的清晰配图),`figureSource` 增加 `upload` 取值;第 20 版用户偏好新增手机底部第 4 个入口 `mobileNavFourth`(默认 `exams`,也可为 `review`);第 19 版的试卷题目包含 `figureImage`(来源错题的原配图快照)与 `figureSource`,试卷可继续切换原图或 AI 重绘;第 18 版起真题库改为全站共享,`questionBanks` 不再带 `userId`,个人备份不含题库,仅整站导出(管理员导出全部数据)包含全部题库。第 17 版新增错题的 `figureImage`(识别时裁剪的原配图)与 `figureSource`,以及第 16 版的 `practiceQuestions`(独立练习生成题)与 `practiceRecords.practiceQuestionId`;待校对任务与未完成的多题批次不再导出,也不再参与导入,它们带整页图片,只在原设备继续处理。旧版备份中的这些字段导入时直接忽略或按 `svg` 处理,其余数据照常还原;导入本身不会调用 AI。 +自定义题型(设置 → 通用 → 题型管理)随个人与整站备份导出,导入时按 key 复用、同名题型跳过;旧版备份没有该字段时按空列表处理,已有错题的题型 key 保持不变。导出文件为第 24 版:新增顶层 `customQuestionTypes`(用户自定义题型及其说明);第 23 版试卷题目新增 `bankQuestionId`(真题库来源题目 ID 快照);第 22 版错题新增 `analysisFigureSvg`(AI 生成的解析配图);第 21 版错题与试卷题目新增 `figureUploadImage`(用户手动上传的清晰配图),`figureSource` 增加 `upload` 取值;第 20 版用户偏好新增手机底部第 4 个入口 `mobileNavFourth`(默认 `exams`,也可为 `review`);第 19 版的试卷题目包含 `figureImage`(来源错题的原配图快照)与 `figureSource`,试卷可继续切换原图或 AI 重绘;第 18 版起真题库改为全站共享,`questionBanks` 不再带 `userId`,个人备份不含题库,仅整站导出(管理员导出全部数据)包含全部题库。第 17 版新增错题的 `figureImage`(识别时裁剪的原配图)与 `figureSource`,以及第 16 版的 `practiceQuestions`(独立练习生成题)与 `practiceRecords.practiceQuestionId`;待校对任务与未完成的多题批次不再导出,也不再参与导入,它们带整页图片,只在原设备继续处理。旧版备份中的这些字段导入时直接忽略或按 `svg` 处理,其余数据照常还原;导入本身不会调用 AI。 第 14 版起 `questionBanks` 记录真题库元信息与全部题目;旧版备份没有该字段时导入为空。第 18 版起题库全站共享:整站备份中的 `questionBanks` 覆盖全部题库、不含 `userId`,旧版文件中的该字段导入时忽略;个人与合并导入不写题库,仅整站导入(管理员)还原。题库导入按原 ID 去重,同名题库追加「(导入)」后缀,题目批量还原且不影响已有错题。第 16 版起练习生成题连同作答记录一起还原,旧版记录没有 `practiceQuestionId` 时仍按快照还原。第 17 版起错题配图原图随题还原,第 19 版起试卷题目的原图快照与显示来源也随卷还原,`figureImage` 仅接受 PNG data URI,`figureUploadImage` 接受 PNG/JPEG/WebP data URI;无效或超长时丢弃并回退到仍可显示的来源。 第 7 版起导出文件新增 `extensions` 命名空间,用于 fork 项目存放私有扩展数据(如题库元数据)。`extensions` 按 `: { version, data }` 组织,每个扩展自行管理版本号;上游默认导出空对象 `{}`,导入时对未注册的 key 安全跳过并记录警告,版本高于当前程序支持的扩展同样跳过。fork 项目可在 `src/lib/backup-extensions.ts` 的 `BACKUP_EXTENSIONS` 数组中注册扩展。 diff --git a/doc/wiki/en/Backup-and-Restore-en.md b/doc/wiki/en/Backup-and-Restore-en.md index 8e56d53a..e5bd310b 100644 --- a/doc/wiki/en/Backup-and-Restore-en.md +++ b/doc/wiki/en/Backup-and-Restore-en.md @@ -33,7 +33,7 @@ System and custom tags retain their tag system and parent-child hierarchy. Ident Question figures, GeoGebra demos, Chinese and English SVG animations with their synthesized cloud voice (MP3), the latest similar question and mastery probability are all restored from the export file; SVG is sanitized again on import, and questions without a mastery probability are re-evaluated after import. Exam papers are restored together with their questions and every recorded result; questions still being generated at export time show as failed after import and can be regenerated on the exam page. Importing your own export file also restores preferences such as the question grade rule and fixed grade, review before import, the duplicate threshold, GeoGebra demos, SVG animations and the interface theme. -Export files use version 23: exam questions add `bankQuestionId` (the source bank-question ID snapshot); version 22 notebook questions add `analysisFigureSvg` (the AI-generated analysis figure); version 21 added `figureUploadImage` (a clear figure uploaded by the user) and the `upload` value to `figureSource` on notebook and exam questions; version 20 user preferences include `mobileNavFourth` (default `exams`, or `review`) for the 4th mobile bottom button. Version 19 added `figureImage` (the source question's cropped original figure) and `figureSource` to exam questions, so a paper can keep switching between the original crop and the AI-redrawn SVG. From version 18 question banks are shared site-wide and `questionBanks` no longer carries `userId`; personal exports contain no banks, and only a full-site export (the administrator exporting all data) includes every bank. Version 17 added `figureImage` (the cropped original figure) and `figureSource` for questions, alongside the version 16 `practiceQuestions` (independent practice variants) and `practiceRecords.practiceQuestionId`; tasks awaiting review and unfinished multi-question batches are no longer exported or imported, as they carry full-page images and continue processing only on the original device. These fields in older backups are ignored or defaulted to `svg` on import while the rest of the data is restored as before; importing never calls the AI. +Custom question types (Settings → General → Question types) are exported with personal and full-site backups; import reuses a type by key and skips a same-named existing type, while older backups without the field import as an empty list and existing questions keep their type key. Export files use version 24: a top-level `customQuestionTypes` array (user-defined types with instructions); version 23 added `bankQuestionId` to exam questions (the source bank-question ID snapshot); version 22 notebook questions add `analysisFigureSvg` (the AI-generated analysis figure); version 21 added `figureUploadImage` (a clear figure uploaded by the user) and the `upload` value to `figureSource` on notebook and exam questions; version 20 user preferences include `mobileNavFourth` (default `exams`, or `review`) for the 4th mobile bottom button. Version 19 added `figureImage` (the source question's cropped original figure) and `figureSource` to exam questions, so a paper can keep switching between the original crop and the AI-redrawn SVG. From version 18 question banks are shared site-wide and `questionBanks` no longer carries `userId`; personal exports contain no banks, and only a full-site export (the administrator exporting all data) includes every bank. Version 17 added `figureImage` (the cropped original figure) and `figureSource` for questions, alongside the version 16 `practiceQuestions` (independent practice variants) and `practiceRecords.practiceQuestionId`; tasks awaiting review and unfinished multi-question batches are no longer exported or imported, as they carry full-page images and continue processing only on the original device. These fields in older backups are ignored or defaulted to `svg` on import while the rest of the data is restored as before; importing never calls the AI. Version 14 adds `questionBanks` with bank metadata and all questions; older backups without the field import as empty. From version 18 banks are shared site-wide: a full-site backup covers every bank and has no `userId`, and the field in older files is ignored on import; personal and merge imports do not write banks, and only a full-site import (administrator) restores them. Bank import deduplicates by original bank ID, appends "(imported)" to a conflicting name, and restores questions in bulk without affecting existing mistakes. Version 16 restores practice variants together with their answer records; older records without `practiceQuestionId` still restore from their snapshots. Version 17 restores the cropped figure with each question; version 19 also restores exam-question figure snapshots and their display source, `figureImage` accepts only PNG data URIs, while `figureUploadImage` accepts PNG/JPEG/WebP data URIs; invalid or oversized values are dropped and fall back to a source that is still displayable. Version 7 adds an `extensions` namespace for fork projects to store private extension data (such as question-bank metadata). `extensions` is organized as `: { version, data }`; each extension manages its own version. The upstream exports an empty object `{}` by default; on import, unregistered keys are safely skipped with a warning, and extensions newer than the running program are skipped as well. Fork projects can register extensions in the `BACKUP_EXTENSIONS` array in `src/lib/backup-extensions.ts`.