Skip to content

feat(writer): 扩展多平台文档接入、转换与编辑能力 - #1329

Merged
wzh1994 merged 27 commits into
LazyAGI:mainfrom
Mustafa974:dev-tool
Sep 18, 2026
Merged

wzh1994 merged 27 commits into
LazyAGI:mainfrom
Mustafa974:dev-tool

Conversation

@Mustafa974

Copy link
Copy Markdown
Collaborator

概述

扩展 Writer 的文档来源和写回能力,接入 GitHub 仓库与 Wiki、Obsidian、微信公众号草稿及 Google Drive 只读文档,并统一平台能力声明、内容转换与写回流程。完善 Markdown 范围编辑、表格结构和图片处理,让跨平台文档修改保留原有结构,并支持通用格式导出。

核心改动

1. 扩展文档平台接入

  • GitHub:支持仓库 Markdown 和 Wiki 文档读写、图片资源处理及原有布局恢复;Wiki 按需读取,减少不必要的写后回读。
  • Obsidian:支持本地 Vault 文件访问、多 Vault 发现、笔记定位与写回,保留 frontmatter 并处理本地图片引用。
  • 微信公众号:支持草稿读取、创建、修改及封面和正文图片上传,提供排版模板;局部修改时保留未改动的 HTML、样式及文章元数据。
  • Google Drive:复用文件系统授权加载 Markdown、文本、JSON、Google Docs 和 Sheets 等文本类内容;仅提供读取能力,对格式损失和不支持的文件类型明确反馈。

2. 统一平台能力与转换、写回流程

  • 按平台声明并暴露读取、创建、替换、追加、补丁、版本检查和媒体能力,在调用前检查是否支持。
  • 分离内容转换与外部写回,支持复用已转换的平台内容,并提供独立的 Markdown、LaTeX 和纯文本导出。
  • 完善远端版本冲突及写入结果不明确时的错误表达,避免将不确定的写入结果当作可直接重试的失败。
  • 优化飞书、Notion 的结构保留与批量更新流程。

3. 完善文档编辑与结构保留

  • 按选定范围处理 Markdown 删除和改写,完善定位、修改计划、批量改写和精确补丁提示词。
  • 保留 Markdown 锚点身份,兼容孤立锚点,并校验改写后的图片引用。
  • 统一表格的行、单元格结构及校验,完善跨平台表格转换、编号和未修改内容保留。
  • 优化图片缓存和资源并发处理,减少重复下载。

4. 增加 Markdown 到 LaTeX 转换

  • 接入 Pandoc 转换,提供中英文 LaTeX 模板及过滤器,处理表格、公式和图片等内容。
  • 通用格式转换与平台原生写回分别使用对应接口,便于导出及后续复用。

5. 配套修正

  • 修正 Qwen 图片生成接口路由与尺寸参数处理,支持 wan2.6-t2i,并将 DashScope 最低版本提升至 1.25.7。
  • 修正启用 tracing 时的 module_trace 继承与使用逻辑,未显式覆盖时沿用上下文配置。
  • 补充平台接入、转换、编辑相关文档及回归用例。

Gxyrious and others added 26 commits September 7, 2026 14:44
* refactor(writer): route document IO through providers

* enhance auto-heading-number (#51)

* enhance auto-number

* fix outline not applied to section draft

* fix IR route with given outline

* fix Markdown drafting

* minor fix

* fix IR cross sorts

* fix

* feat(writer): add outline instruction and subtask models

* feat(writer): complete outline instructions and subtasks

* feat(writer): add Notion document integration (#52)

* feat(writer): add Notion document integration

* test(writer): merge and simplify Notion writer tests

---------

Co-authored-by: 陈思羽 <chensiyu2@60359784m.domain.sensetime.com>

* feat(writer): parallelize writing subtasks

* fix(writer): preserve anchors for HTML images

* feat(writer): support wechat official account

* refine wechat default image placeholder

* refine wechat match

* abstract image downloads to base provider

* fix(writer): satisfy lint and documentation checks

---------

Co-authored-by: Mustafa974 <920998500@qq.com>
Co-authored-by: Chen Siyu <109125168+Blink0214@users.noreply.github.com>
Co-authored-by: 陈思羽 <chensiyu2@60359784m.domain.sensetime.com>
Co-authored-by: Letong Han <41274989+Mustafa974@users.noreply.github.com>
* refactor(writer): route document IO through providers

* enhance auto-heading-number (#51)

* enhance auto-number

* fix outline not applied to section draft

* fix IR route with given outline

* fix Markdown drafting

* minor fix

* fix IR cross sorts

* fix

* feat(writer): add outline instruction and subtask models

* feat(writer): complete outline instructions and subtasks

* feat(writer): add Notion document integration (#52)

* feat(writer): add Notion document integration

* test(writer): merge and simplify Notion writer tests

---------

Co-authored-by: 陈思羽 <chensiyu2@60359784m.domain.sensetime.com>

* feat(writer): parallelize writing subtasks

* feat(writer): add GitHub repository and wiki provider

* fix(writer): preserve GitHub media references

* test(writer): focus GitHub media coverage

* fix(writer): preserve GitHub media on write-back

* fix(writer): validate GitHub media write-back

* test(writer): streamline GitHub integration coverage

* feat(writer): support creating GitHub Wiki pages

* feat(writer): support creating GitHub Wiki pages

* fix(writer): preserve anchors for HTML images

* fix(writer): preserve markdown code fences

* refactor(writer): preserve canonical GitHub document state

* fix(writer): adapt unsupported GitHub code fences

* fix(writer): preserve imported markdown image URLs

* fix(writer): retain GitHub media preview aliases

* test(writer): consolidate GitHub integration coverage

* test(writer): focus GitHub tests on core flows

* refactor(writer): resolve provider create targets internally

* fix(writer): reuse GitHub Wiki checkout for reads

* fix(writer): select Wiki read sessions by target type

* fix(writer): avoid fetching Wiki blobs for writes

* fix(writer): commit partial Wiki checkouts without blobs

---------

Co-authored-by: Mustafa974 <920998500@qq.com>
Co-authored-by: Gxyrious <83438334+Gxyrious@users.noreply.github.com>
Co-authored-by: Chen Siyu <109125168+Blink0214@users.noreply.github.com>
Co-authored-by: 陈思羽 <chensiyu2@60359784m.domain.sensetime.com>
Co-authored-by: Anonymous <anonymous@users.noreply.github.com>
Co-authored-by: Letong Han <41274989+Mustafa974@users.noreply.github.com>
Move WriterDocument editability normalization into LazyLLM so host workflows can delegate without duplicating document logic. Define and enforce explicit provider capability declarations, require an adapter for document creation, and guard WeChat patch-by-replace with remote revision validation.
Co-authored-by: Anonymous <anonymous@users.noreply.github.com>
* feat(writer): add Markdown-to-LaTeX conversion

* fix(writer): route LaTeX copy through Pandoc conversion

* fix(writer): constrain LaTeX table widths

---------

Co-authored-by: 陈思羽 <chensiyu2@60359784m.domain.sensetime.com>
* feat(obsidian): add Vault filesystem and Writer provider

* feat(writer): preserve Obsidian syntax and media assets

* refactor(writer): preserve provider write results

* test(obsidian): remove obsolete display path assertion

* fix(obsidian): keep absolute paths out of locator parsing

* refactor(obsidian): align media handling with writer resources

* feat(obsidian): preserve provider write results

* feat(obsidian): preserve local write-back metadata

* fix(obsidian): enforce Vault root for generic filesystem operations

* fix(obsidian): preserve image references and markdown whitespace
* fix(writer): preserve editor content after GitHub writes

* fix(github): fetch Wiki pages and resources on demand

---------

Co-authored-by: Anonymous <anonymous@users.noreply.github.com>
* fix(writer): cache GitHub images and download with 8 workers

* fix(writer): profile resources concurrently with up to 8 workers

---------

Co-authored-by: Anonymous <anonymous@users.noreply.github.com>
# Conflicts:
#	tests/basic_tests/Tools/test_writer_stream_tools.py
)

* fix(writer): preserve provider structure and batch document updates

Preserve Feishu and Notion table captions, bindings, equations, and image references across document conversion and writes. Batch compatible updates and reuse persisted write results to avoid redundant document reads.

* refactor writer cloud document integrations

---------

Co-authored-by: 陈思羽 <chensiyu2@60359784m.domain.sensetime.com>
* fix(writer): restore scoped Markdown deletion and precise fragment prompts

* fix(writer): clarify Markdown revision targeting and minimal deletion

* fix(writer): preserve source punctuation forms in replacements

---------

Co-authored-by: Anonymous <anonymous@users.noreply.github.com>
@Mustafa974
Mustafa974 requested review from a team as code owners September 18, 2026 06:51
@Mustafa974
Mustafa974 requested review from a team as code owners September 18, 2026 06:51
@wzh1994
wzh1994 merged commit 71579a5 into LazyAGI:main Sep 18, 2026
4 of 5 checks passed

This branch is waiting to be deployed

1 waiting deployment
protected 15f2d0eb Waiting Sep 18, 2026 by Mustafa974 via wait_approve #5462
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.

6 participants