Background integration and ai features in theme editing. #2

Closed
opened 2026-04-13 14:14:26 +00:00 by casper-stevens · 7 comments
Member

Ai theme editing

  • every other feature to restructure a specific or all slides in general has some ai features. there are some discrepancies between the windows which should also be fixed.
  • the ones that have them are the edit markdown for the specific slides and the edit instructions.
  • fix these discrepancies and add the same features to edit theme.
  • there is some funky behavior in the save & generate button in edit markdown to where it does nothing(?)

Background

  • right now the background feature is not able to be used because there is an if statement preventing it from showing. there should be a more obvious approach to get the background to work without going through some steps behind the scenes.
  • read the following to understand the goal of the background and implement accordingly:
Background Files

Background files are reference documents that give the AI extra context when generating slides. They live in the background/ folder inside each deck.

Managing Backgrounds

The background panel is on the left side of the Slides tab:
Uploading Files

    Click Upload Files to select files from your computer
    Drag and drop files directly onto the panel
    Supported formats: .md, .pdf, .txt, and images

Organizing into Folders

    Click Create Folder to add a new folder
    Drag files between folders to organize them
    Each folder shows its file count

PDF Extraction

PDF files can be converted to markdown for better AI processing:

    Right-click a PDF file in the background panel
    Select Extract .md
    A markdown version is created alongside the PDF
    The extracted text is used as context for slide generation

Deleting Files

    Click the delete button on any file or folder
    Or right-click and select Delete
    Multi-select with Ctrl/Cmd+Click then delete all selected

Using Backgrounds in Generation

Background files are automatically available as context when:

    Running the AI Agent on the deck
    Using the Instruct panel to give specific instructions

In the Instruct panel and Create Slide modal, you can select which specific background files to include:

    Browse the checkbox tree of available backgrounds
    Check the files relevant to your current slide
    The AI will reference this material when generating content

Multi-Select Operations

Hold Ctrl/Cmd or Shift to select multiple files, then:

    Delete all selected
    Move to folder — move all selected files to a different folder
    Extract PDFs — batch-extract all selected PDF files to markdown
  • there is also a feature to make folders which doesn't seem to work all of the time.

PS: i have done some work already so there could be some stuff done already

## Ai theme editing - every other feature to restructure a specific or all slides in general has some ai features. there are some discrepancies between the windows which should also be fixed. - the ones that have them are the edit markdown for the specific slides and the edit instructions. - fix these discrepancies and add the same features to edit theme. - there is some funky behavior in the save & generate button in edit markdown to where it does nothing(?) ## Background - right now the background feature is not able to be used because there is an if statement preventing it from showing. there should be a more obvious approach to get the background to work without going through some steps behind the scenes. - read the following to understand the goal of the background and implement accordingly: ``` Background Files Background files are reference documents that give the AI extra context when generating slides. They live in the background/ folder inside each deck. Managing Backgrounds The background panel is on the left side of the Slides tab: Uploading Files Click Upload Files to select files from your computer Drag and drop files directly onto the panel Supported formats: .md, .pdf, .txt, and images Organizing into Folders Click Create Folder to add a new folder Drag files between folders to organize them Each folder shows its file count PDF Extraction PDF files can be converted to markdown for better AI processing: Right-click a PDF file in the background panel Select Extract .md A markdown version is created alongside the PDF The extracted text is used as context for slide generation Deleting Files Click the delete button on any file or folder Or right-click and select Delete Multi-select with Ctrl/Cmd+Click then delete all selected Using Backgrounds in Generation Background files are automatically available as context when: Running the AI Agent on the deck Using the Instruct panel to give specific instructions In the Instruct panel and Create Slide modal, you can select which specific background files to include: Browse the checkbox tree of available backgrounds Check the files relevant to your current slide The AI will reference this material when generating content Multi-Select Operations Hold Ctrl/Cmd or Shift to select multiple files, then: Delete all selected Move to folder — move all selected files to a different folder Extract PDFs — batch-extract all selected PDF files to markdown ``` - there is also a feature to make folders which doesn't seem to work all of the time. PS: i have done some work already so there could be some stuff done already
Author
Member

Implementation Spec for Issue #2

Objective

Complete the background panel feature so it is always visible and functional when a deck is selected, and add the same AI editing features (Fix, Rewrite) to the Theme Editor that already exist in the Edit Markdown and Edit Instructions modals. Also fix the broken "Save & Generate" button in the markdown editor and align UI consistency across the three editor overlays.

Current State Summary

Several partial fixes already exist in the working diff:

  • discovery.rs: Empty background folders are no longer skipped
  • dashboard.js: loadBgPanel() guard changed so background panel shows whenever a deck is selected
  • dashboard.css / index.html: Background panel toggle visual polish

Requirements

  1. The background panel must always be visible when a deck is selected (not gated on existing background content)
  2. Creating a new background folder must reliably create the folder, update the panel, and mark currentDeckHasBackground = true
  3. File uploads to background must support .md, .pdf, .txt, and common image types (.png, .jpg, .jpeg, .gif, .webp)
  4. The "Save & Generate" button in the markdown editor must save the slide then trigger generation in the parent window
  5. The Theme Editor must have AI Fix and Rewrite buttons matching the pattern used in the other editors
  6. New backend RPC handlers deck.fixTheme and deck.rewriteTheme must exist
  7. Prompt templates for theme fix and rewrite must exist in crates/hero_slides_lib/src/prompts/
  8. UI button ordering in all three editor overlays should be consistent

Files to Modify/Create

File Action Description
crates/hero_slides_lib/src/prompts/system_fix_theme.md Create Prompt template for AI minimal-fix of a theme.md file
crates/hero_slides_lib/src/prompts/system_rewrite_theme.md Create Prompt template for AI comprehensive rewrite of a theme.md file
crates/hero_slides_lib/src/deck.rs Modify Extend deck_save_background_file to accept .txt and image extensions
crates/hero_slides_server/src/agent.rs Modify Add handle_fix_theme and handle_rewrite_theme async functions
crates/hero_slides_server/src/rpc.rs Modify Register deck.fixTheme and deck.rewriteTheme in the dispatch table
crates/hero_slides_ui/templates/index.html Modify Add Fix/Rewrite buttons to theme editor; fix background upload accept= attribute
crates/hero_slides_ui/static/js/dashboard.js Modify Add fixThemeContent(), rewriteThemeContent(); fix saveAndGenerate() bug; update bg upload filter
crates/hero_slides_ui/static/css/dashboard.css Modify Minor layout consistency for theme editor topbar if needed

Implementation Plan

Step 1: Create prompt templates for theme AI

Files: crates/hero_slides_lib/src/prompts/system_fix_theme.md, system_rewrite_theme.md

  • Create system_fix_theme.md modeled on system_fix_instructions.md — minimal corrections, no restructuring, output only corrected theme markdown
  • Create system_rewrite_theme.md modeled on system_rewrite_instructions.md — clean comprehensive rewrite with defined sections (Color Palette, Typography, Layout, etc.)

Dependencies: none

Step 2: Add backend RPC handlers for theme AI

Files: crates/hero_slides_server/src/agent.rs, crates/hero_slides_server/src/rpc.rs

  • Add handle_fix_theme and handle_rewrite_theme async functions in agent.rs following the pattern of handle_fix_instructions / handle_rewrite_instructions
  • Register deck.fixTheme and deck.rewriteTheme in the match block in rpc.rs

Dependencies: Step 1

Step 3: Extend background file upload to support .txt and images

Files: crates/hero_slides_lib/src/deck.rs, crates/hero_slides_ui/templates/index.html, crates/hero_slides_ui/static/js/dashboard.js

  • In deck.rs: extend the extension allowlist in deck_save_background_file
  • In discovery.rs: extend find_background_files to list .txt and image files; read_background_content treats .txt like .md
  • In index.html: update <input accept=".md,.pdf"> and drop zone label
  • In dashboard.js: update bgUploadFiles extension filter

Dependencies: none (independent)

Step 4: Fix the Save & Generate bug in Edit Markdown

Files: crates/hero_slides_ui/static/js/dashboard.js

  • Root cause: closeEditor() calls window.close() before generateSlide() can run
  • Fix: call window.opener.generateSlide(editorSlideName, true) before calling closeEditor()

Dependencies: none (independent)

Step 5: Add AI buttons to Theme Editor HTML

Files: crates/hero_slides_ui/templates/index.html

  • Add Fix and Rewrite buttons to the theme editor overlay editor-actions div
  • Button order: [Status label] [Fix] [Rewrite] [Save] [Save & Generate All] [Close]

Dependencies: none (can be written before Step 2 if function names are agreed)

Step 6: Add AI JS functions for Theme Editor

Files: crates/hero_slides_ui/static/js/dashboard.js

  • Add fixThemeContent() and rewriteThemeContent() following the same pattern as fixInstructions() / rewriteInstructions()
  • Include timer, disable/enable textarea, status label updates, toast on success/error

Dependencies: Steps 2, 5

Acceptance Criteria

  • Background panel is visible whenever a deck is selected, even with no background content
  • "Create Folder" creates a folder and it appears immediately in the tree
  • .md, .pdf, .txt, and image files can be uploaded to background folders
  • "Save & Generate" in Edit Markdown saves the slide and triggers generation in the parent window, then closes
  • Theme Editor has a "Fix" button that calls deck.fixTheme AI
  • Theme Editor has a "Rewrite" button that calls deck.rewriteTheme AI
  • AI operations in theme editor disable the textarea and show elapsed time in the status label
  • deck.fixTheme and deck.rewriteTheme RPC endpoints return { "content": "..." }
  • Prompt templates for fix and rewrite theme exist in the prompts directory
  • Button ordering is consistent across all three editor overlays

Notes

  • The partial fixes in the current working diff (discovery.rs, dashboard.js, CSS) are correct and should remain. They address the background panel visibility.
  • Steps 1, 3, and 4 are fully independent and can run in parallel.
  • Steps 5 and 6 can start once Step 2 function names are agreed.
  • .txt files should be read as plain text (same as .md). Images are stored but not included in text context for now.
  • The saveAndGenerate fix uses window.opener.generateSlide() and falls back gracefully if opener is not available.
## Implementation Spec for Issue #2 ### Objective Complete the background panel feature so it is always visible and functional when a deck is selected, and add the same AI editing features (Fix, Rewrite) to the Theme Editor that already exist in the Edit Markdown and Edit Instructions modals. Also fix the broken "Save & Generate" button in the markdown editor and align UI consistency across the three editor overlays. ### Current State Summary Several partial fixes already exist in the working diff: - `discovery.rs`: Empty background folders are no longer skipped - `dashboard.js`: `loadBgPanel()` guard changed so background panel shows whenever a deck is selected - `dashboard.css` / `index.html`: Background panel toggle visual polish ### Requirements 1. The background panel must always be visible when a deck is selected (not gated on existing background content) 2. Creating a new background folder must reliably create the folder, update the panel, and mark `currentDeckHasBackground = true` 3. File uploads to background must support `.md`, `.pdf`, `.txt`, and common image types (`.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`) 4. The "Save & Generate" button in the markdown editor must save the slide then trigger generation in the parent window 5. The Theme Editor must have AI Fix and Rewrite buttons matching the pattern used in the other editors 6. New backend RPC handlers `deck.fixTheme` and `deck.rewriteTheme` must exist 7. Prompt templates for theme fix and rewrite must exist in `crates/hero_slides_lib/src/prompts/` 8. UI button ordering in all three editor overlays should be consistent ### Files to Modify/Create | File | Action | Description | |---|---|---| | `crates/hero_slides_lib/src/prompts/system_fix_theme.md` | Create | Prompt template for AI minimal-fix of a theme.md file | | `crates/hero_slides_lib/src/prompts/system_rewrite_theme.md` | Create | Prompt template for AI comprehensive rewrite of a theme.md file | | `crates/hero_slides_lib/src/deck.rs` | Modify | Extend `deck_save_background_file` to accept `.txt` and image extensions | | `crates/hero_slides_server/src/agent.rs` | Modify | Add `handle_fix_theme` and `handle_rewrite_theme` async functions | | `crates/hero_slides_server/src/rpc.rs` | Modify | Register `deck.fixTheme` and `deck.rewriteTheme` in the dispatch table | | `crates/hero_slides_ui/templates/index.html` | Modify | Add Fix/Rewrite buttons to theme editor; fix background upload `accept=` attribute | | `crates/hero_slides_ui/static/js/dashboard.js` | Modify | Add `fixThemeContent()`, `rewriteThemeContent()`; fix `saveAndGenerate()` bug; update bg upload filter | | `crates/hero_slides_ui/static/css/dashboard.css` | Modify | Minor layout consistency for theme editor topbar if needed | ### Implementation Plan #### Step 1: Create prompt templates for theme AI Files: `crates/hero_slides_lib/src/prompts/system_fix_theme.md`, `system_rewrite_theme.md` - Create `system_fix_theme.md` modeled on `system_fix_instructions.md` — minimal corrections, no restructuring, output only corrected theme markdown - Create `system_rewrite_theme.md` modeled on `system_rewrite_instructions.md` — clean comprehensive rewrite with defined sections (Color Palette, Typography, Layout, etc.) Dependencies: none #### Step 2: Add backend RPC handlers for theme AI Files: `crates/hero_slides_server/src/agent.rs`, `crates/hero_slides_server/src/rpc.rs` - Add `handle_fix_theme` and `handle_rewrite_theme` async functions in `agent.rs` following the pattern of `handle_fix_instructions` / `handle_rewrite_instructions` - Register `deck.fixTheme` and `deck.rewriteTheme` in the match block in `rpc.rs` Dependencies: Step 1 #### Step 3: Extend background file upload to support `.txt` and images Files: `crates/hero_slides_lib/src/deck.rs`, `crates/hero_slides_ui/templates/index.html`, `crates/hero_slides_ui/static/js/dashboard.js` - In `deck.rs`: extend the extension allowlist in `deck_save_background_file` - In `discovery.rs`: extend `find_background_files` to list `.txt` and image files; `read_background_content` treats `.txt` like `.md` - In `index.html`: update `<input accept=".md,.pdf">` and drop zone label - In `dashboard.js`: update `bgUploadFiles` extension filter Dependencies: none (independent) #### Step 4: Fix the Save & Generate bug in Edit Markdown Files: `crates/hero_slides_ui/static/js/dashboard.js` - Root cause: `closeEditor()` calls `window.close()` before `generateSlide()` can run - Fix: call `window.opener.generateSlide(editorSlideName, true)` before calling `closeEditor()` Dependencies: none (independent) #### Step 5: Add AI buttons to Theme Editor HTML Files: `crates/hero_slides_ui/templates/index.html` - Add Fix and Rewrite buttons to the theme editor overlay `editor-actions` div - Button order: `[Status label] [Fix] [Rewrite] [Save] [Save & Generate All] [Close]` Dependencies: none (can be written before Step 2 if function names are agreed) #### Step 6: Add AI JS functions for Theme Editor Files: `crates/hero_slides_ui/static/js/dashboard.js` - Add `fixThemeContent()` and `rewriteThemeContent()` following the same pattern as `fixInstructions()` / `rewriteInstructions()` - Include timer, disable/enable textarea, status label updates, toast on success/error Dependencies: Steps 2, 5 ### Acceptance Criteria - [ ] Background panel is visible whenever a deck is selected, even with no background content - [ ] "Create Folder" creates a folder and it appears immediately in the tree - [ ] `.md`, `.pdf`, `.txt`, and image files can be uploaded to background folders - [ ] "Save & Generate" in Edit Markdown saves the slide and triggers generation in the parent window, then closes - [ ] Theme Editor has a "Fix" button that calls `deck.fixTheme` AI - [ ] Theme Editor has a "Rewrite" button that calls `deck.rewriteTheme` AI - [ ] AI operations in theme editor disable the textarea and show elapsed time in the status label - [ ] `deck.fixTheme` and `deck.rewriteTheme` RPC endpoints return `{ "content": "..." }` - [ ] Prompt templates for fix and rewrite theme exist in the prompts directory - [ ] Button ordering is consistent across all three editor overlays ### Notes - The partial fixes in the current working diff (discovery.rs, dashboard.js, CSS) are correct and should remain. They address the background panel visibility. - Steps 1, 3, and 4 are fully independent and can run in parallel. - Steps 5 and 6 can start once Step 2 function names are agreed. - `.txt` files should be read as plain text (same as `.md`). Images are stored but not included in text context for now. - The `saveAndGenerate` fix uses `window.opener.generateSlide()` and falls back gracefully if opener is not available.
Author
Member

Test Results

Status: FAIL

  • Total: 42
  • Passed: 41
  • Failed: 1

Failure Details

Test: discovery::tests::test_find_background_folders

Location: crates/hero_slides_lib/src/discovery.rs:361

Error:

thread 'discovery::tests::test_find_background_folders' panicked at crates/hero_slides_lib/src/discovery.rs:361:9:
assertion `left == right` failed
  left: 3
 right: 2

The test expected 2 background folders but found 3. This is likely caused by a new background folder being present in the test environment that was not anticipated by the test assertion.

## Test Results **Status:** FAIL - Total: 42 - Passed: 41 - Failed: 1 ### Failure Details **Test:** `discovery::tests::test_find_background_folders` **Location:** `crates/hero_slides_lib/src/discovery.rs:361` **Error:** ``` thread 'discovery::tests::test_find_background_folders' panicked at crates/hero_slides_lib/src/discovery.rs:361:9: assertion `left == right` failed left: 3 right: 2 ``` The test expected 2 background folders but found 3. This is likely caused by a new background folder being present in the test environment that was not anticipated by the test assertion.
Author
Member

Implementation Summary

All changes have been implemented and tests are passing (57 tests, 0 failures).

Changes Made

crates/hero_slides_lib/src/prompts/system_fix_theme.md (new)
Prompt template for AI minimal-fix of a theme.md file -- makes minimum corrections only, does not restructure.

crates/hero_slides_lib/src/prompts/system_rewrite_theme.md (new)
Prompt template for comprehensive AI rewrite of a theme.md file -- produces a well-structured result with defined sections (Color Palette, Typography, Layout, Backgrounds, Accent Elements, Mood & Tone).

crates/hero_slides_server/src/agent.rs (modified)
Added handle_fix_theme and handle_rewrite_theme async functions, following the same pattern as the instructions handlers.

crates/hero_slides_server/src/rpc.rs (modified)
Registered deck.fixTheme and deck.rewriteTheme RPC endpoints.

crates/hero_slides_lib/src/deck.rs (modified)
Extended deck_save_background_file to accept .txt, .png, .jpg, .jpeg, .gif, .webp in addition to .md and .pdf.

crates/hero_slides_lib/src/discovery.rs (modified)
Extended find_background_folders, find_background_files, and read_background_content to include .txt and image files. .txt files are read as plain text; images are stored but not included in text context. Updated test to reflect that empty folders are now included.

crates/hero_slides_ui/templates/index.html (modified)

  • Added Fix and Rewrite AI buttons to the theme editor overlay (before the Save button)
  • Updated background file input accept attribute and drop zone label to include .txt and image types

crates/hero_slides_ui/static/js/dashboard.js (modified)

  • Added fixThemeContent() and rewriteThemeContent() functions (same pattern as fixInstructions/rewriteInstructions)
  • Fixed saveAndGenerate() bug: now calls window.opener.generateSlide() before closeEditor() so generation is triggered in the parent window
  • Updated bgUploadFiles extension filter and toast to include .txt and image types

crates/hero_slides_ui/static/css/dashboard.css (modified -- pre-existing partial fix)
Background panel toggle visual polish.

Test Results

  • Total: 57
  • Passed: 57
  • Failed: 0

One test (test_find_background_folders) was updated to reflect the new behavior where empty background folders are included (previously they were skipped, which caused the panel not to show when only empty folders existed).


--- ## Implementation Summary All changes have been implemented and tests are passing (57 tests, 0 failures). ### Changes Made **`crates/hero_slides_lib/src/prompts/system_fix_theme.md`** (new) Prompt template for AI minimal-fix of a theme.md file -- makes minimum corrections only, does not restructure. **`crates/hero_slides_lib/src/prompts/system_rewrite_theme.md`** (new) Prompt template for comprehensive AI rewrite of a theme.md file -- produces a well-structured result with defined sections (Color Palette, Typography, Layout, Backgrounds, Accent Elements, Mood & Tone). **`crates/hero_slides_server/src/agent.rs`** (modified) Added `handle_fix_theme` and `handle_rewrite_theme` async functions, following the same pattern as the instructions handlers. **`crates/hero_slides_server/src/rpc.rs`** (modified) Registered `deck.fixTheme` and `deck.rewriteTheme` RPC endpoints. **`crates/hero_slides_lib/src/deck.rs`** (modified) Extended `deck_save_background_file` to accept `.txt`, `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp` in addition to `.md` and `.pdf`. **`crates/hero_slides_lib/src/discovery.rs`** (modified) Extended `find_background_folders`, `find_background_files`, and `read_background_content` to include `.txt` and image files. `.txt` files are read as plain text; images are stored but not included in text context. Updated test to reflect that empty folders are now included. **`crates/hero_slides_ui/templates/index.html`** (modified) - Added Fix and Rewrite AI buttons to the theme editor overlay (before the Save button) - Updated background file input `accept` attribute and drop zone label to include `.txt` and image types **`crates/hero_slides_ui/static/js/dashboard.js`** (modified) - Added `fixThemeContent()` and `rewriteThemeContent()` functions (same pattern as `fixInstructions`/`rewriteInstructions`) - Fixed `saveAndGenerate()` bug: now calls `window.opener.generateSlide()` before `closeEditor()` so generation is triggered in the parent window - Updated `bgUploadFiles` extension filter and toast to include `.txt` and image types **`crates/hero_slides_ui/static/css/dashboard.css`** (modified -- pre-existing partial fix) Background panel toggle visual polish. ### Test Results - Total: 57 - Passed: 57 - Failed: 0 One test (`test_find_background_folders`) was updated to reflect the new behavior where empty background folders are included (previously they were skipped, which caused the panel not to show when only empty folders existed). ---
Author
Member

Test Results

  • Total: 42
  • Passed: 41
  • Failed: 1

Failure Details

Test: discovery::tests::test_find_background_folders
File: crates/hero_slides_lib/src/discovery.rs:360

thread 'discovery::tests::test_find_background_folders' panicked at crates/hero_slides_lib/src/discovery.rs:360:9:
assertion `left == right` failed
  left: 0
 right: 1

The test asserts that at least one background folder is found, but the result was 0. This likely indicates a test environment issue where the expected directory structure or fixture data is missing.

## Test Results - Total: 42 - Passed: 41 - Failed: 1 ### Failure Details **Test:** `discovery::tests::test_find_background_folders` **File:** `crates/hero_slides_lib/src/discovery.rs:360` ``` thread 'discovery::tests::test_find_background_folders' panicked at crates/hero_slides_lib/src/discovery.rs:360:9: assertion `left == right` failed left: 0 right: 1 ``` The test asserts that at least one background folder is found, but the result was 0. This likely indicates a test environment issue where the expected directory structure or fixture data is missing.
Author
Member

Test Results

Status: All passing

  • Total: 57
  • Passed: 57
  • Failed: 0

Fixed a copy-paste error in test_find_background_folders where folders[1] was checked instead of folders[2] for the style folder file count.

## Test Results **Status: All passing** - Total: 57 - Passed: 57 - Failed: 0 Fixed a copy-paste error in `test_find_background_folders` where `folders[1]` was checked instead of `folders[2]` for the style folder file count.
Author
Member

Implementation Summary

All changes from the spec have been implemented. Here is a breakdown by file:

New Files

  • crates/hero_slides_lib/src/prompts/system_fix_theme.md — minimal-fix prompt for AI theme correction
  • crates/hero_slides_lib/src/prompts/system_rewrite_theme.md — comprehensive rewrite prompt for AI theme improvement

Modified Files

crates/hero_slides_server/src/agent.rs

  • Added handle_fix_theme — loads system_fix_theme.md, calls AI, returns { "content": "..." }
  • Added handle_rewrite_theme — same pattern using system_rewrite_theme.md

crates/hero_slides_server/src/rpc.rs

  • Registered deck.fixTheme and deck.rewriteTheme in the dispatch table
  • Updated handle_bg_read_file to return .txt files as UTF-8 text instead of base64

crates/hero_slides_lib/src/deck.rs

  • Extended deck_save_background_file to accept .txt in addition to .md and .pdf

crates/hero_slides_lib/src/discovery.rs

  • find_background_folders: added .txt, .png, .jpg, .jpeg, .webp, .gif to extension filter; removed file_count == 0 guard so empty folders are visible
  • find_background_files: added same new extensions to listing filter
  • read_background_content: added .txt to text-readable extensions (images excluded from AI context)
  • Fixed copy-paste bug in test_find_background_folders (was checking folders[1] instead of folders[2] for style folder file count)

crates/hero_slides_ui/templates/index.html

  • Added Fix and Rewrite buttons to theme editor topbar (matching markdown and instructions editors)
  • Updated background file input accept attribute to include .txt, .png, .jpg, .jpeg, .webp, .gif
  • Updated drop zone label text to list all accepted file types

crates/hero_slides_ui/static/js/dashboard.js

  • Added fixThemeContent() and rewriteThemeContent() — follow exact same pattern as slide/instructions equivalents
  • Fixed saveAndGenerate() bug: now saves the slide then calls window.opener.generateSlide() before closing
  • Fixed loadBgPanel() gate: panel now shows whenever a deck is selected (removed currentDeckHasBackground requirement)
  • Extended bgUploadFiles() to accept .txt, .png, .jpg, .jpeg, .webp, .gif
  • Updated renderBgFiles() icon mapping: image extensions get bi-file-earmark-image
  • Updated bgPreviewFile(): image files render as <img> data URIs; .txt renders as text

Test Results

57 tests, 57 passed, 0 failed

## Implementation Summary All changes from the spec have been implemented. Here is a breakdown by file: ### New Files - `crates/hero_slides_lib/src/prompts/system_fix_theme.md` — minimal-fix prompt for AI theme correction - `crates/hero_slides_lib/src/prompts/system_rewrite_theme.md` — comprehensive rewrite prompt for AI theme improvement ### Modified Files **`crates/hero_slides_server/src/agent.rs`** - Added `handle_fix_theme` — loads `system_fix_theme.md`, calls AI, returns `{ "content": "..." }` - Added `handle_rewrite_theme` — same pattern using `system_rewrite_theme.md` **`crates/hero_slides_server/src/rpc.rs`** - Registered `deck.fixTheme` and `deck.rewriteTheme` in the dispatch table - Updated `handle_bg_read_file` to return `.txt` files as UTF-8 text instead of base64 **`crates/hero_slides_lib/src/deck.rs`** - Extended `deck_save_background_file` to accept `.txt` in addition to `.md` and `.pdf` **`crates/hero_slides_lib/src/discovery.rs`** - `find_background_folders`: added `.txt`, `.png`, `.jpg`, `.jpeg`, `.webp`, `.gif` to extension filter; removed `file_count == 0` guard so empty folders are visible - `find_background_files`: added same new extensions to listing filter - `read_background_content`: added `.txt` to text-readable extensions (images excluded from AI context) - Fixed copy-paste bug in `test_find_background_folders` (was checking `folders[1]` instead of `folders[2]` for style folder file count) **`crates/hero_slides_ui/templates/index.html`** - Added Fix and Rewrite buttons to theme editor topbar (matching markdown and instructions editors) - Updated background file input `accept` attribute to include `.txt`, `.png`, `.jpg`, `.jpeg`, `.webp`, `.gif` - Updated drop zone label text to list all accepted file types **`crates/hero_slides_ui/static/js/dashboard.js`** - Added `fixThemeContent()` and `rewriteThemeContent()` — follow exact same pattern as slide/instructions equivalents - Fixed `saveAndGenerate()` bug: now saves the slide then calls `window.opener.generateSlide()` before closing - Fixed `loadBgPanel()` gate: panel now shows whenever a deck is selected (removed `currentDeckHasBackground` requirement) - Extended `bgUploadFiles()` to accept `.txt`, `.png`, `.jpg`, `.jpeg`, `.webp`, `.gif` - Updated `renderBgFiles()` icon mapping: image extensions get `bi-file-earmark-image` - Updated `bgPreviewFile()`: image files render as `<img>` data URIs; `.txt` renders as text ### Test Results 57 tests, 57 passed, 0 failed
Author
Member

finished, waiting for write access to repos

finished, waiting for write access to repos
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_slides#2
No description provided.