Skip to content

docs(crates/panache-mcp): 在建稿时说明正文插图的线稿效果 - #58

Merged
SXP-Simon merged 2 commits into
mainfrom
split/49-illustration
Nov 27, 2026
Merged

SXP-Simon merged 2 commits into
mainfrom
split/49-illustration

Conversation

@SXP-Simon

@SXP-Simon SXP-Simon commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

场景与改动

用户希望保留正文中彩色示意图的颜色,但内嵌图在手写页上会画成线稿。

在建稿工具的 Markdown 参数和指南里说明效果,颜色重要时先看小样,并保留原图在正文中的位置。

用户可在交付前确认画面,也可从原稿中继续取得原图。

独立验证

构建本分支的 panache-mcp,运行 uv run --script crates/panache-mcp/tests/inline_image_outline.py <binary>。 配置本地字体和已生成的 Markdown worker,或设置 PANACHE_FONT_DIR 和 PANACHE_MARKDOWN_WORKER。

从 #49 拆出,直接基于 main@06cfd43,可以独立审查。来源提交为 1647a97。

Summary by Sourcery

Document and validate the outline-only rendering behavior for embedded images in handwritten pages.

Enhancements:

  • Clarify that embedded images are preserved in the source but rendered as hand-drawn outlines without their original colors, and advise users to preview color-sensitive content while keeping images inline.
  • Add an independent validation script covering source preservation and outline rendering for inline images.

Documentation:

  • Document inline image rendering behavior and preview guidance in the panache-mcp README and save_section parameter documentation.

Tests:

  • Add an end-to-end check verifying that embedded image data is retained while the rendered preview omits the original color and includes an outline.

背景:用户希望保留正文中彩色示意图的颜色,但内嵌图在手写页上会画成线稿。

解决手段:在建稿工具的 Markdown 参数和指南里说明效果,颜色重要时先看小样,并保留原图在正文中的位置。

收益:用户可在交付前确认画面,也可从原稿中继续取得原图。
@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Explain in the save_section Markdown parameter that embedded images are preserved in the source but rendered as outlines without their original colors, and advise previewing color-sensitive images while keeping them inline.

  • crates/panache-mcp/src/inputs.rs L147-148

Documentation

Add user guidance on inline image outline rendering and previewing color-sensitive illustrations, alongside the homework defaults and paper instructions.

  • crates/panache-mcp/README.md L65-66

Tests

Add an end-to-end check that the inline image is preserved in saved Markdown while the rendered page does not retain its original magenta color.

  • crates/panache-mcp/tests/inline_image_outline.py L1-54

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@SXP-Simon

Copy link
Copy Markdown
Owner Author

拆分依据与实测

原 #49 留下的证据。 原研究在两段文字中间插入彩色图,改字后源 PNG 摘要不变。实际选择的 ZIP 和小样一致,但原洋红、蓝色在默认成品中消失;用原纸背景保留颜色是另一个使用场景。 原 PR 说明 · 原色、轮廓和纸照三组核验

本次独立分支验证(c9d5d63)。 inline_image_outline.py 在真实工具目录确认参数说明。插入洋红色矩形后,按原文读回的 PNG 数据完全相同;只有插图的成品含深色轮廓,原洋红色像素为 0,检查单新增为 0。

Rust 1.94.1 单独构建,目标 crate 的 16 项单元测试和 Clippy 均通过。

七个分支都直接基于同一个 main 提交,21 对分支试合并均无冲突,正序和逆序七项合并得到相同文件树。组合后重新构建,18 个 MCP 单测通过,并核对握手、14 个工具的接口及相关的真实 stdio 场景。

SXP-Simon added a commit that referenced this pull request Nov 27, 2026
## 为什么改

在循环分析作业里,模型用工具推荐的原生绘图语法画流程图,在两条分支箭头旁写上条件。解析器遇到 `node[midway,right]` 和
`\le` 时,按现有保底行为把整段源代码当作正文。模型随后改用外部 PNG,图和正文的笔迹很难一致。

## 这个草稿做什么

识别连线上的 `midway` 标签,以及标签里的 ≤ 和 ≥
命令。直线的标签放在中间,直角路径的标签放在转角,继续画线仍然从原来的端点出发。仅扩展已有绘图子集,其余未知样式继续保留原文。

一个可单独重现的片段:

```tex
\begin{circuitikz}
\draw[->] (0,0) -- (4,0) node[midway,above] {$i\le10$};
\end{circuitikz}
```

## 本机证据

- 用 Windows 真实 MCP 和文本预处理器,分别保存同一段六节点、含循环回边的流程图。基线第一页布局返回 **410**
个字形,开头是反斜杠、b、e、g。此分支返回 **1** 个图形,打开 PNG 能看到六个节点、条件和箭头。
- 10 项语法回归和 1 项实际电路导出测试通过,核心 crate 的 Clippy
通过。测试覆盖路径端点、折线、无前置路径的中点标签和未知选项。
- 可以独立合入。#58 讨论导入位图后的线稿效果,本草稿修复在使用位图之前就发生的原生绘图失败。

## Summary by Sourcery

Enable native rendering of circuit flowchart conditions placed along
connection paths.

New Features:
- Support `midway` labels on straight and right-angle circuit paths,
including condition text using ≤ and ≥ symbols.

Bug Fixes:
- Prevent supported flowchart condition labels from causing the circuit
parser to fall back to rendering the entire source as text while
preserving path endpoints and rejecting unsupported options.

Tests:
- Add regression coverage for midpoint and corner labels, Unicode
inequality conversion, endpoint preservation, and unsupported midpoint
options.
背景:主线的作业默认值和 #58 的正文插图说明写在指南的同一处。

解决手段:将最新主线并入草稿分支,先说明作业默认值,再说明插图的线稿效果。

收益:两种使用场景均可查阅,原 PR 可继续独立审查。
@SXP-Simon
SXP-Simon marked this pull request as ready for review November 27, 2026 07:44
@sourcery-ai

sourcery-ai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Sorry @SXP-Simon, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 9 hours and 38 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@SXP-Simon
SXP-Simon merged commit 3ba0994 into main Nov 27, 2026
SXP-Simon added a commit that referenced this pull request Nov 27, 2026
## 为什么改

一份手写作业里,模型改用 PNG
画方框和箭头。缩小看整页时,模型把成品交了出来,使用者后来指出图线比文字粗很多。原有照片外观提示主要看文字和底纸,推荐区域可能没有框到图。

## 这个草稿做什么

- 看普通成图时,若本节含内嵌位图的标记,返回一句针对图文混排页的提醒:选一段图线和附近字,在同一倍率下看粗细和墨色。普通成图仍可直接看。
-
整页检查利用已有的本页布局与调整后的坐标,找第一张位图和附近的非位图笔迹。二者能一起放进原尺寸裁图时,直接返回可复制的局部预览参数。区域过大或超出纸面时,改为提醒选小区域。比较同页图和字只需当前版本。
- 局部检查沿用已有只读预览。是否偏粗由看到的图像决定。若图确实太重,可以改插图源并复看,正文的墨色不需要跟着改。#58
讲的是导入时位图如何变成线稿,此处处理的是成图后怎样验收。

## Windows 实际验证

- 合成纸上放入手写字和一张含方框、横线的 PNG。工具给出的 **179 × 178
像素**区域同时包含插图和正文字形,局部调用返回底纸与成图两张裁图,保持原倍率。纯文字页和纯图片页均不产生整页图文对照建议。局部取图没有新增整页检查记录。
-
用同一页有意画粗的方框图、同一随机种子和同一句「像同一支笔写的,能交吗」做独立会话对照。转发器省略启动说明,保留真实工具及图像,核对工具调用与回答。

| 版本 | Luna | Terra |
| --- | --- | --- |
| 当前 main | 从整页指出图粗,未取局部裁图 | 从整页指出图粗,未取局部裁图 |
| 最终草稿 | 从整页指出图粗,未取局部裁图 | 按参数取回 **291 × 212** 裁图,再指出框和连线比字粗黑 |

中间版本还暴露了两个问题:只有整页检查带提示时,Luna
有一次只看普通成图,判断「可以交」。加入普通预览提示后,它又曾把同页对照误填为比较两个相同版本。因此最终两个入口都说明了同页如何检查。两模型每个版本各一次,最终对这张明显粗线图的识别均为
**2/2**。有证据的收益是 Terra 主动取到同倍率裁图,尚不能据此判断模型识别率提高。

MCP 的 16 项单元测试和 Clippy 通过。新增的真实 stdio 回归可用 `python
crates/panache-mcp/tests/illustration_ink_check.py <panache-mcp>`
复跑。该自动建议聚焦每页第一张位图,原生流程图的生成问题由 #63 独立处理。

## Summary by Sourcery

Enable MCP reviews to identify and compare embedded illustration lines
with nearby handwriting without changing the surrounding text ink.

New Features:
- Add image-preview guidance for comparing embedded diagram strokes with
nearby handwriting at the same zoom.
- Generate page-level review regions and native-scale preview parameters
covering the first embedded image and adjacent text when available.

Enhancements:
- Track text versus illustration glyphs through rendering and fine-edit
geometry to support mixed-content inspection.

Documentation:
- Document the recommended review workflow for comparing hand-drawn
diagrams with nearby writing.

Tests:
- Add an end-to-end MCP regression covering mixed diagram and text
previews, crop contents, and review-record behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant