Skip to content

Add text-only editable PPTX export option#489

Open
Anionex wants to merge 8 commits into
mainfrom
feat/editable-text-only-export
Open

Add text-only editable PPTX export option#489
Anionex wants to merge 8 commits into
mainfrom
feat/editable-text-only-export

Conversation

@Anionex

@Anionex Anionex commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add an editable PPTX export dialog option, "Only Text Layers Editable" / 「仅文字层可编辑」, defaulting to off.
  • Pass text_only through the frontend API, export controller, async task, and PPTX builder.
  • In text-only mode, erase only detected editable text regions from the slide background, preserve non-text visuals such as icons/images/charts, and overlay detected text as editable text boxes.
  • Add VLM verification for text-only backgrounds: retry failed erasures up to 3 attempts and keep the candidate with the fewest missed text regions if none fully pass.
  • Harden editable export task submission so a queue/submit failure marks the committed task as FAILED instead of leaving it stuck in PENDING.
  • Update zh/en docs and README notes for the new export behavior.

E2E / Product Verification

  • Playwright coverage verifies the new checkbox is off by default and sends text_only: true only after the user checks it.
  • Manual browser path on the current Vite frontend (http://127.0.0.1:3462): opened preview, clicked Export -> Export Editable PPTX, confirmed 「仅文字层可编辑」 defaults unchecked, checked it, clicked Start Export, and verified the request body contained { "text_only": true }.
  • Real backend export verification on current worktree backend (http://127.0.0.1:5630): exported project 01fde026-1f13-45fa-a14c-ec024c9a3ed4 with text_only=true; task 38030f02-0925-4883-b7ec-86705954ce01 completed with warnings=0.
  • Real VLM/background verification log: text_only 底图验证结果: success=True missed=0 unwanted=0.
  • Generated PPTX artifact inspection: ppt/media/ contains exactly one image, and that media SHA equals text_only_clean_background.png but not the original slide image; slide1.xml has 1 picture object, 3 text boxes, no chart/embedding/diagram objects.

Tests

  • uv run python -m compileall backend
  • uv run python -m py_compile backend/services/export_service.py backend/services/prompts.py backend/tests/unit/test_editable_pptx_equations.py
  • uv run python -m py_compile backend/services/export_service.py (after PIL lifecycle fix)
  • uv run python -m py_compile backend/services/export_service.py backend/services/task_manager.py backend/controllers/export_controller.py
  • uv run python -m py_compile backend/services/export_service.py backend/services/image_editability/service.py
  • uv run python -m py_compile backend/controllers/export_controller.py backend/tests/unit/test_editable_pptx_export_controller.py
  • uv run python -m flake8 backend/ --count --select=E9,F63,F7,F82 --show-source --statistics
  • uv run pytest backend/tests/unit/test_editable_pptx_equations.py -q
  • uv run pytest backend/tests/unit/test_editable_pptx_equations.py -q (14 passed after PIL lifecycle fix)
  • uv run pytest backend/tests/unit/test_editable_pptx_equations.py backend/tests/unit/test_icon_subject_extraction.py -q
  • uv run pytest backend/tests/unit/test_editable_pptx_equations.py backend/tests/unit/test_icon_subject_extraction.py -q (32 passed after rebase/review fixes)
  • uv run pytest backend/tests/unit/test_editable_pptx_export_controller.py backend/tests/unit/test_editable_pptx_equations.py -q
  • uv run pytest backend/tests/unit/test_editable_pptx_equations.py backend/tests/unit/test_editable_pptx_export_controller.py -q
  • SKIP_SERVICE_TESTS=true npm run test:backend (475 passed, 8 skipped)
  • cd frontend && npm run lint (passes with existing warnings only)
  • npm run test:frontend (127 passed)
  • cd frontend && CI=1 BASE_URL=http://127.0.0.1:3462 npx playwright test e2e/editable-export-failure.spec.ts --reporter=list (3 passed)

CI / Review

  • Latest CI for commit 5ae3a29 is passing: Quick Check, Docs Link Check, and Smoke Test are green; Mintlify is skipped for the final run.
  • Gemini Code Assist review comments from commits 58d3a31 and d7ab7a3 were addressed and resolved; open review threads: 0. A fresh review was requested for 5ae3a29, and no new inline thread is open.

Note

  • A first raw npm run test:backend attempt earlier in this PR reported 2 failures in backend/tests/integration/test_api_full_flow.py because those tests connect to a real external backend service. With no BACKEND_PORT exported they hit an old local service on localhost:5011, whose logs showed sqlite3.OperationalError: unable to open database file. The code-relevant backend suite passed with the test file's SKIP_SERVICE_TESTS=true gate.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@Anionex

Anionex commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new 'Only Text Layers Editable' (text_only) option for PPTX exports, allowing users to preserve the original slide image as a background while overlaying only detected text as editable text boxes. The changes span the frontend UI, API endpoints, backend export services, documentation, and tests. The review feedback highlights a potential runtime issue when initializing an empty inpaint registry under text_only mode, and suggests a performance optimization to avoid set subtraction overhead inside a loop.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread backend/services/export_service.py
Comment thread backend/services/export_service.py Outdated
@Anionex

Anionex commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an 'Only Text Layers Editable' (text_only) option for the editable PPTX export feature. When enabled, the original slide image is kept as the background, and only detected text elements are overlaid as editable text boxes, skipping other elements like charts or tables. This change spans documentation, backend controllers, services, tasks, unit tests, frontend API endpoints, UI components, and E2E tests. The review feedback suggests a defensive programming improvement in backend/services/export_service.py to use getattr(elem, 'children', None) instead of directly accessing elem.children to prevent potential AttributeError exceptions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread backend/services/export_service.py
@Anionex

Anionex commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@mintlify

mintlify Bot commented Jul 3, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
anionex 🟢 Ready View Preview Jul 3, 2026, 12:15 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new "Only Text Layers Editable" option for PPTX exports, allowing users to keep the original slide image as the background and overlay only detected text as editable text boxes. The changes include backend support, frontend UI integration, documentation updates, and new unit and E2E tests. Feedback was provided to handle potential background task submission failures in the export controller, ensuring that tasks do not get stuck in a PENDING state if submission fails.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread backend/controllers/export_controller.py Outdated
@Anionex

Anionex commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new 'Only Text Layers Editable' (text_only) option for exporting editable PPTX presentations. When enabled, the full slide image is kept as the background, and only detected text elements are overlaid as editable text boxes, bypassing background inpainting and non-text element extraction. The changes span backend API endpoints, task management, and export services, along with corresponding frontend UI updates, localization, unit tests, and documentation. Additionally, a try-except block was added to handle task submission failures gracefully in the export controller. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Anionex

Anionex commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the "Only Text Layers Editable" (text_only) option for editable PPTX exports. When enabled, the system generates a background that erases only detected text (with VLM verification and retries) while preserving non-text visuals, overlaying the detected text as editable text boxes. The changes span backend services, controllers, task management, frontend UI components, documentation, and tests. The review comments provide valuable feedback to improve robustness: preventing a potential AttributeError if _inpaint_registry is None, avoiding redundant inpainting attempts when VLM verification is unavailable, and resolving redundant parsing and log flooding in the verification loop.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread backend/services/image_editability/service.py Outdated
Comment thread backend/services/export_service.py Outdated
Comment thread backend/services/export_service.py Outdated
@Anionex
Anionex force-pushed the feat/editable-text-only-export branch from 58d3a31 to d7ab7a3 Compare July 3, 2026 12:59
@Anionex

Anionex commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the "Only Text Layers Editable" (text_only) option for PPTX exports, which erases only detected text from the background while preserving other visual elements, overlaying the text as editable text boxes. It also implements VLM verification to ensure background text erasure with automatic retries. Feedback focuses on preventing potential memory leaks in backend/services/export_service.py by properly managing the lifecycle of temporary PIL Image objects using context managers.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread backend/services/export_service.py Outdated
Comment thread backend/services/export_service.py
@Anionex

Anionex commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

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