Skip to content

feat(crates/panache-mcp): 并排检查插图线条和附近笔迹 - #65

Merged
SXP-Simon merged 2 commits into
mainfrom
fix/worksheet-ink
Nov 27, 2026
Merged

SXP-Simon merged 2 commits into
mainfrom
fix/worksheet-ink

Conversation

@SXP-Simon

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

Copy link
Copy Markdown
Owner

为什么改

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

这个草稿做什么

  • 看普通成图时,若本节含内嵌位图的标记,返回一句针对图文混排页的提醒:选一段图线和附近字,在同一倍率下看粗细和墨色。普通成图仍可直接看。
  • 整页检查利用已有的本页布局与调整后的坐标,找第一张位图和附近的非位图笔迹。二者能一起放进原尺寸裁图时,直接返回可复制的局部预览参数。区域过大或超出纸面时,改为提醒选小区域。比较同页图和字只需当前版本。
  • 局部检查沿用已有只读预览。是否偏粗由看到的图像决定。若图确实太重,可以改插图源并复看,正文的墨色不需要跟着改。docs(crates/panache-mcp): 在建稿时说明正文插图的线稿效果 #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.

背景:整页缩略图上容易忽略位图插图和附近笔迹的粗细差异。

解决手段:在整页检查中用当前页几何推荐同时覆盖插图与附近笔迹的原尺寸检查区域。

收益:客户端能在同一倍率下看清线宽差异,按图局部处理。
@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Add an internal text marker to glyph tiles and bounds so later review logic can distinguish handwritten characters from illustration elements.

  • crates/handwriting-core/src/fine_edit.rs L38-39, L66, L133

Implementation

Propagate the text marker through rendered line units and captured tiles, classifying illustration tiles as non-text.

  • crates/handwriting-core/src/render.rs L50, L560, L590
  • crates/handwriting-core/src/render/fine.rs L180
  • crates/handwriting-core/src/render/illustration.rs L152

Use adjusted page geometry to find the first embedded illustration and nearest visible text, then provide a native-scale review region when the combined crop fits on the page.

  • crates/panache-mcp/src/engine.rs L356-396
  • crates/panache-mcp/src/review.rs L33-36, L85, L315-342

UI

Add guidance to ordinary image previews so users compare an embedded drawing with nearby writing at the same zoom and use only the current revision.

  • crates/panache-mcp/src/inputs.rs L302
  • crates/panache-mcp/src/preview.rs L169-179

Tests

Add an end-to-end MCP regression covering image and text combinations, suggested review crops, layout contents, and review-record behavior.

  • crates/panache-mcp/tests/illustration_ink_check.py L1-79

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

背景:仅凭排版单元没有位图编号来找正文,会把原生箭头当成字,即使整页只有两幅图也返回图文对照裁图。

解决手段:在排版时标明字符单元,把标记传给整页检查,只从正文中选参照,并排除手调为全透明的字形。

收益:Windows 真实 MCP 回归中,只有方框和箭头时不再推荐裁图。在箭头后加一个「字」,推荐的 264 × 263 裁图同时框到方框和该字。原图文用例仍返回 179 × 178 裁图,纯字和单图页均不触发。
@SXP-Simon
SXP-Simon marked this pull request as ready for review November 27, 2026 07:56
@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 2 days and 20 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@SXP-Simon
SXP-Simon merged commit d22d76f into main Nov 27, 2026
1 check passed
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