|
101 | 101 | > 内容 |
102 | 102 | 7. 有趣类比或助记技巧用斜体。 |
103 | 103 | 8. 图片插入规则(严格遵守): |
104 | | - - **仅插入含视觉元素的图片**:图表、流程图、架构图、代码截图、数学推导、数据可视化等。 |
105 | | - - **禁止插入纯文字图片**:纯文字要点、定义、标题幻灯片——笔记本身已用文字表达更好。 |
106 | | - - 每隔 2–3 个概念段落插入一张图片,紧跟其说明的概念之后。 |
| 104 | + - **插入且仅插入含视觉元素的图片**:图表、流程图、架构图、代码截图、数学推导、数据可视化等。如果是与课程无关的行政或其他元素(如课程信息、投票二维码、签到提示等),即使是图片也不要插入。 |
| 105 | + - 纯文字要点、定义、标题幻灯片不需要插入——笔记本身已用文字表达更好。 |
| 106 | + - 尽可能多地插入含视觉元素的图片,紧跟其说明的概念之后。 |
107 | 107 | - 幻灯片格式:` *(一句话描述)*` |
108 | 108 | - 屏幕录制帧格式:` *(一句话描述)*` |
109 | 109 | (LXX 由调用方提供,禁止自行修改)。 |
|
126 | 126 | 要求: |
127 | 127 | - 本片段对应笔记的二级标题为 `### {lec_num}.{chunk_idx} {chunk_title}`(**不要输出此行**,由调用方添加) |
128 | 128 | - 详细度:{detail}/10。{detail_instruction} |
129 | | -- 图片插入:**仅插入含图表/代码/公式等视觉元素的图片**,跳过纯文字截图。 |
| 129 | +- 图片插入:**插入所有含视觉元素的图片**(图表、流程图、架构图、代码截图、数学推导、数据可视化等),跳过纯文字截图和与课程无关的行政元素。 |
130 | 130 | 路径必须完全照抄上方「可用图片」列表中给出的路径(含 images/L** 子目录),禁止自造路径。 |
131 | 131 | 每张图片后加一句斜体括号说明:` *(说明)*` 或 ` *(说明)*` |
132 | 132 | - 代码示例写完整可编译片段(含必要 include/imports),用正确的语言标签(```c, ```cpp, ```python)。 |
|
147 | 147 | 要求: |
148 | 148 | - 本片段对应笔记的二级标题为 `### {lec_num}.{chunk_idx} {chunk_title}`(**不要输出此行**) |
149 | 149 | - 详细度:{detail}/10。{detail_instruction} |
150 | | -- 图片插入:**仅插入含图表/代码/公式等视觉元素的图片**,跳过纯文字截图。 |
| 150 | +- 图片插入:**插入所有含视觉元素的图片**(图表、流程图、架构图、代码截图、数学推导、数据可视化等),跳过纯文字截图和与课程无关的行政元素。 |
151 | 151 | 路径必须完全照抄上方「可用图片」列表中给出的路径(含 images/L** 子目录),禁止自造路径。 |
152 | 152 | 每张图片后加一句斜体括号说明:` *(说明)*` 或 ` *(说明)*` |
153 | 153 | - 代码示例写完整可编译片段,用正确的语言标签(```c, ```cpp, ```python)。 |
|
203 | 203 | > content |
204 | 204 | 7. Use italics for interesting analogies or memory aids. |
205 | 205 | 8. Image insertion rules (strictly follow): |
206 | | - - **Only include images that contain visual elements**: diagrams, flowcharts, graphs, charts, plots, architecture drawings, code screenshots, mathematical derivations with spatial layout, annotated figures, tables with meaningful structure, or any non-trivial visual illustration. |
207 | | - - **Never include images that are purely text**: bullet-point slides, definition slides, title slides, or any frame/slide whose content can be fully expressed in written text. The notes themselves convey text better than a screenshot of text. |
208 | | - - Insert one image every 2–3 concept paragraphs, immediately after the concept it illustrates. |
| 206 | + - **Insert all and only images that contain visual elements**: diagrams, flowcharts, architecture drawings, code screenshots, mathematical derivations, data visualizations, tables with meaningful structure, annotated figures, or any non-trivial visual illustration. Do NOT insert administrative or non-course elements (course info slides, polling QR codes, attendance prompts, etc.) even if they contain images. |
| 207 | + - Pure text slides (bullet points, definitions, titles) do not need images — the notes express text better than a screenshot. |
| 208 | + - Insert as many visual-element images as are available, immediately after the concept they illustrate. |
209 | 209 | - Format for slide images: ` *(one-sentence description)*` |
210 | 210 | - Format for screen-capture frames: ` *(one-sentence description)*` |
211 | 211 | (LXX is provided by the caller — do not modify it; the caption must be in parentheses wrapped in asterisks exactly as shown). |
|
228 | 228 | Requirements: |
229 | 229 | - The section heading for this segment is `### {lec_num}.{chunk_idx} {chunk_title}` (**do not output this line** — it is added by the caller). |
230 | 230 | - Detail level: {detail}/10. {detail_instruction} |
231 | | -- Images: **only include images that contain diagrams, charts, graphs, code screenshots, architecture drawings, or other visual elements that cannot be expressed as text.** Skip images of pure text, bullet points, or definitions — the notes cover that better in writing. Copy the exact path from the "Available images" list (including the images/L** subdirectory). Do not invent paths. After each image, add a one-sentence italic caption: ` *(caption)*` or ` *(caption)*` |
| 231 | +- Images: **insert all images that contain visual elements** (diagrams, charts, graphs, code screenshots, architecture drawings, data visualizations, mathematical derivations, etc.). Skip images of pure text, bullet points, or administrative/non-course elements. Copy the exact path from the "Available images" list (including the images/L** subdirectory). Do not invent paths. After each image, add a one-sentence italic caption: ` *(caption)*` or ` *(caption)*` |
232 | 232 | - Code examples must be complete and compilable (with necessary includes/imports), using the correct language tag (```c, ```cpp, ```python). |
233 | 233 | - Only cover the content in this segment; do not introduce material from other lectures. |
234 | 234 | """, |
|
247 | 247 | Requirements: |
248 | 248 | - The section heading is `### {lec_num}.{chunk_idx} {chunk_title}` (**do not output this line**). |
249 | 249 | - Detail level: {detail}/10. {detail_instruction} |
250 | | -- Images: **only include images that contain diagrams, charts, graphs, code screenshots, or visual elements.** Skip images of pure text or bullet points. Copy the exact path from the "Available images" list (including the images/L** subdirectory). Do not invent paths. After each image, add a one-sentence italic caption: ` *(caption)*` or ` *(caption)*` |
| 250 | +- Images: **insert all images that contain visual elements** (diagrams, charts, graphs, code screenshots, architecture drawings, data visualizations, etc.). Skip images of pure text or administrative/non-course elements. Copy the exact path from the "Available images" list (including the images/L** subdirectory). Do not invent paths. After each image, add a one-sentence italic caption: ` *(caption)*` or ` *(caption)*` |
251 | 251 | - Code examples must be complete and compilable, using the correct language tag (```c, ```cpp, ```python). |
252 | 252 | """, |
253 | 253 | verify="""\ |
@@ -303,7 +303,7 @@ def _detail_instr(level: int) -> str: |
303 | 303 |
|
304 | 304 | IMAGE_FILTER_MODEL = "gpt-4o-mini" |
305 | 305 | IMAGE_FILTER_WORD_MAX = 12 # slides with ≤ this many words → remove without API call |
306 | | -IMAGE_FILTER_HEURISTIC = 35 # slides with > this many words AND no code/desc → remove |
| 306 | +IMAGE_FILTER_HEURISTIC = 80 # slides with > this many words AND no code/desc → remove |
307 | 307 |
|
308 | 308 | # Title/divider patterns that add no visual value |
309 | 309 | _TITLE_PATTERN = re.compile( |
@@ -369,32 +369,26 @@ def _vision_keep(img_path: Path, slide_text: str = "") -> bool: |
369 | 369 | You are a study-notes curator deciding whether a lecture slide image should be \ |
370 | 370 | embedded in written notes.{context_block} |
371 | 371 |
|
372 | | -## TWO conditions must BOTH be true to KEEP an image: |
373 | | -
|
374 | | -1. The slide contains a meaningful visual element: |
| 372 | +## KEEP the image if the slide contains ANY course-relevant visual element: |
375 | 373 | - Diagrams: system/architecture diagrams, component boxes connected by arrows |
376 | 374 | - Flowcharts, state machines, decision trees, sequence/timing diagrams |
377 | 375 | - Memory layouts, address-space maps, cache/pipeline stage illustrations |
378 | 376 | - Graphs, plots, bar/line/pie charts, scatter plots showing data or trends |
379 | 377 | - Tables with a meaningful grid structure (comparing options, relationships) |
380 | 378 | - Mathematical formulas or derivations where spatial layout matters |
| 379 | + - Code screenshots or annotated code with visual highlights |
381 | 380 | - Annotated screenshots, highlighted output, or callout arrows |
| 381 | + - Any non-trivial visual illustration related to the course |
382 | 382 |
|
383 | | -2. The visual element is RELEVANT to the lecture subject matter: |
384 | | - - The diagram, chart, or figure directly explains or illustrates a concept \ |
385 | | -being taught |
386 | | - - It is NOT an administrative or logistical element such as: polling/quiz \ |
387 | | -prompts (PollEv, Mentimeter, Kahoot QR codes), attendance check slides, \ |
388 | | -course schedule tables, "any questions?" slides, logos, or sponsor slides |
389 | | -
|
390 | | -## REMOVE if either condition fails: |
391 | | -- Pure text slides (bullet points, prose, definitions) with no diagram |
392 | | -- Code-only slides (code will be reproduced as text in the notes) |
| 383 | +## REMOVE only if the slide is clearly non-visual or non-course-related: |
| 384 | +- Pure text slides (bullet points, prose, definitions) with absolutely no \ |
| 385 | +diagram, chart, figure, or visual element |
393 | 386 | - Title slides, section dividers, agenda/outline, blank slides |
394 | | -- Slides whose only visual is an unrelated administrative element \ |
395 | | -(QR code for a poll, login instructions, course info graphics) |
| 387 | +- Administrative elements unrelated to the course: polling/quiz prompts \ |
| 388 | +(PollEv, Mentimeter, Kahoot QR codes), attendance check slides, \ |
| 389 | +course info graphics, "any questions?" slides, logos, sponsor slides |
396 | 390 |
|
397 | | -## Default: when genuinely uncertain about relevance, KEEP. |
| 391 | +## Default: when genuinely uncertain, KEEP. |
398 | 392 |
|
399 | 393 | Reply with exactly one word: KEEP or REMOVE.""" |
400 | 394 |
|
@@ -779,8 +773,11 @@ def _build_chunk_prompt( |
779 | 773 | else: |
780 | 774 | cache_key = f"page_{s.index}" |
781 | 775 | desc = img_cache.get(cache_key, "") |
782 | | - if desc or s.word_count < 30 or s.has_code: |
783 | | - note = desc[:80] if desc else ("has code" if s.has_code else "has diagram") |
| 776 | + # Include most slides in the available images list — the LLM |
| 777 | + # decides which to insert. Only skip slides that are clearly |
| 778 | + # heavy-text with no visual/code content and no cached description. |
| 779 | + if desc or s.word_count < 80 or s.has_code: |
| 780 | + note = desc[:80] if desc else ("has code" if s.has_code else "") |
784 | 781 | img_hints_lines.append(f" Slide {s.index+1}: `{rel}` — {note}") |
785 | 782 | image_hints = "\n".join(img_hints_lines) or " (no images for this segment)" |
786 | 783 |
|
|
0 commit comments