mateclaw/mateclaw-server/src/main/java/vip/mate/tool
matevip b4ebab65c7 feat(tool): docx image embedding + multi-file render
Two follow-up improvements on top of renderDocxFromFile so the docx
pipeline can handle real long-form deliverables instead of just
prose-only memos.

Image embedding (P1).
MarkdownDocxRenderer now recognizes single-line ![alt](path) markdown
and embeds the referenced file via POI's XWPFRun.addPicture():
- PNG / JPG / GIF / BMP read straight from disk
- SVG rasterized via Apache Batik (PNGTranscoder, target width 1400px)
  before embedding — OOXML stores raster images, so any vector source
  needs conversion. Batik runs in-JVM, no rsvg-convert / cairo on host.
- Pictures are pinned to roughly the printable page width (≈ 5.77 in
  for A4 minus default 1800-twip margins) and given a 4:3 height
  fallback. Mixing images inline with other paragraph text is not
  supported by design — the markdown subset assumes one image per
  block paragraph. Inline images would require splitting paragraphs
  across runs with explicit positioning, well beyond what this
  renderer covers.
- Failure modes (missing file, unsupported format, Batik blowing up)
  emit an italicised "[image: alt — reason]" placeholder so the rest
  of the document still renders; the agent can read its own log to
  see why the picture didn't make it.
- Adds two transitive deps via pom: batik-transcoder + batik-codec at
  1.18, ~10 MB combined. Worth it given the alternative is shelling
  out to system tooling.

Multi-file render (P2-lite).
New tool renderDocxFromFiles(List<String> filePaths, filename, pageSize)
reads several markdown files in order and renders one combined docx.
Lets the agent split a 30-page proposal into cover.md / ch1.md /
ch2.md / appendix.md and produce a single deliverable in one tool
call. Each path goes through WorkspacePathGuard.validatePath; any
empty or unreadable file aborts with a typed error so the agent
fixes its file list before retrying. Files are joined with a blank
line — no separator markup is injected, headings carry over cleanly.

I deliberately did NOT build the heavier mutable-docx state
("appendDocxChapter / finalizeDocx") flavor of P2: the multi-file
form covers the same workflow with no per-conversation state to
clean up, and the agent can iterate by rewriting the chapter file
and re-running the tool. Stateful append can come later if a
streaming use case actually shows up.

renderDocx and renderDocxFromFile @Tool descriptions updated to point
the agent at renderDocxFromFile for >5 KB markdown and to advertise
the new image-embedding capability.
2026-04-27 08:42:03 +08:00
..
browser fix(browser): multi-strategy launcher + self-diagnostics for win/linux 2026-04-24 21:37:46 +08:00
builtin feat(tool): docx image embedding + multi-file render 2026-04-27 08:42:03 +08:00
controller Initial commit: MateClaw — Java + Vue 3 AI Assistant System 2026-04-04 19:03:49 +08:00
document feat(tool): docx image embedding + multi-file render 2026-04-27 08:42:03 +08:00
guard refactor(db): drop @TableLogic on all entities, purge soft-deleted rows 2026-04-18 23:31:48 +08:00
image feat(minimax): expand video model catalog + add CN endpoint support 2026-04-26 08:34:35 +08:00
mcp feat(tool): tool returnDirect and sensitive-data quarantine 2026-04-25 19:02:35 +08:00
model refactor(db): drop @TableLogic on all entities, purge soft-deleted rows 2026-04-18 23:31:48 +08:00
music feat: add TTS, STT, music generation, video providers (Runway/MiniMax), image providers (Google Imagen/MiniMax), and tool registry fix 2026-04-08 08:49:09 +08:00
repository Initial commit: MateClaw — Java + Vue 3 AI Assistant System 2026-04-04 19:03:49 +08:00
search fix(search): bundled SearXNG sidecar actually works out of the box 2026-04-24 22:08:42 +08:00
service feat(i18n): structured i18n keys for exceptions and auto-translate 100+ error messages 2026-04-11 17:52:25 +08:00
video feat(minimax): expand video model catalog + add CN endpoint support 2026-04-26 08:34:35 +08:00
ConcurrencyUnsafe.java feat(agent): runtime efficiency — spill oversized tool results, add tool concurrency registry, collect cache metrics 2026-04-19 08:28:45 +08:00
ToolConcurrencyRegistry.java feat(agent): runtime efficiency — spill oversized tool results, add tool concurrency registry, collect cache metrics 2026-04-19 08:28:45 +08:00
ToolRegistry.java fix(skill): also accept Spring bean names as tool-dep identifiers 2026-04-24 23:24:52 +08:00