Skip to content

fix(crates/panache-mcp): 说明练习纸照片应传到哪台电脑 - #57

Merged
SXP-Simon merged 1 commit into
mainfrom
split/49-photo
Nov 27, 2026
Merged

SXP-Simon merged 1 commit into
mainfrom
split/49-photo

Conversation

@SXP-Simon

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

Copy link
Copy Markdown
Owner

场景与改动

聊天窗口可以看见练习纸照片,但运行 Panache 的电脑有时还读不到文件。

在握手、建稿参数和无效路径回执说明照片所需的位置,客户端传送成功后可重试同一次建稿请求。

遇到缺图时能解释如何补齐材料,重试成功后继续在原纸上写。

独立验证

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

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

Summary by Sourcery

Ensure worksheet photos are transferred to the Panache computer and support safe retries when the image is initially unavailable.

Bug Fixes:

  • Clarify that worksheet photos must be transferred to, and readable by, the computer running Panache instead of being supplied as remote paths or URLs.
  • Allow users to retry the same draft creation request after making an unavailable worksheet image locally accessible, while preserving the original paper for continued writing.

Enhancements:

  • Improve MCP guidance and error messages for missing or inaccessible paper images, including actionable instructions for client transfer or using the computer that contains the photo.

Documentation:

  • Update panache-mcp documentation to explain how chat attachments must be transferred before use and why paths from other devices cannot be used.

Tests:

  • Add an integration test covering unavailable paths, unchanged draft state, successful retry after transfer, and preservation of the original paper image.

背景:聊天窗口可以看见练习纸照片,但运行 Panache 的电脑有时还读不到文件。

解决手段:在握手、建稿参数和无效路径回执说明照片所需的位置,客户端传送成功后可重试同一次建稿请求。

收益:遇到缺图时能解释如何补齐材料,重试成功后继续在原纸上写。
@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

API

Clarify in the MCP tool parameter and handshake instructions that a worksheet photo must be transferred to the computer running Panache before retrying the draft request.

  • crates/panache-mcp/src/inputs.rs L103-104
  • crates/panache-mcp/src/main.rs L280

Implementation

Return actionable guidance when the supplied paper path is not an image file readable by the computer running Panache.

  • crates/panache-mcp/src/paper.rs L159

Documentation

Explain how to transfer a chat photo to Panache and clarify that a path on another computer does not transfer the file.

  • crates/panache-mcp/README.md L61

Tests

Verify unavailable paths leave the draft store unchanged and that retrying after transferring the image succeeds while retaining the original paper.

  • crates/panache-mcp/tests/paper_path_retry.py L1-53

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 留下的证据。 原试验把“路径不可用”“照片放到服务端后的重试”分别核对。后续 8 条纸照对照没有支持再多加一句提醒,且出现漏用横纸的反例。这里沿用原有导入机制。 原 PR 说明 · 12 种路径检查 · 真实服务的路径对照 · 恢复传送和横纸反例

本次独立分支验证(4b22ec7)。 paper_path_retry.py 试了不存在的中文路径和聊天网址,两个请求都失败且数据库内容一致。把照片放到同一路径后建稿成功,成品保留了原纸 200,000 个像素中的 198,894 个。

Rust 1.94.1 单独构建,目标 crate 的 16 项单元测试和 Clippy 均通过。 原版固定回放记录

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

@SXP-Simon
SXP-Simon marked this pull request as ready for review November 27, 2026 06:33
@SXP-Simon
SXP-Simon merged commit d49c53a into main Nov 27, 2026
@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 22 hours by commenting @sourcery-ai review. Upgrade to get a review now.

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

用户给了一张有页眉和横线的作业纸,希望在这张纸上写字。一次实际使用中,客户端先取出页眉,在新的白色 A4 画布重画横线,再把这张新图传给
`paper_path`。最后虽然传了 `photo`,工具保留下来的已经是重画的纸。

## 这个草稿做什么

在创建稿件的 `paper_mode` 字段解释怎么选输入文件:要写在给定纸上,就把原文件直接传给
`paper_path`,默认照片模式会保留页眉、横线和拍摄角度。交付 PDF 也可以使用原照片。用户要求拉正时用
`flatten`,要求空白模板时才另行重画。

与 #57 可以分别审查。#57 解决的是服务端从哪里读取文件,这里解决的是读到原件之后该用哪一张图。

## 本机证据

- Windows 真实 stdio 调用。对合成的斜横线纸加一个颜色独特的页眉标记,建稿后用 `view=paper` 读回,全部 RGB
像素与输入相同。成稿保留尺寸及标记,正文区域有新增笔迹,PDF 成功导出 1 页。这个试验证实提示所指的用法在现有引擎上可行。
- Luna 和 Terra 各在独立会话对照一次。两份可读材料分别是实拍纸的合成样例和打印模板,任务指定在实拍纸上写,最后交
PDF。转发器省略启动说明,保留真实工具及图像。基线和此分支均为 **2/2** 直接使用原图。这个对照中没有测出成功率提升。
- 测试客户端限用
MCP,未复现原会话中另写脚本重画的完整自由度。收益是字段说明澄清了操作意图。这是一个提示草稿,如果只优先合有实测提升的改动,可以后审。

## Summary by Sourcery

Enhancements:
- Clarify paper input guidance so drafts written on a supplied sheet
preserve the original header, rulings, and perspective, while
distinguishing when to straighten or recreate a blank template.
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