2 instruction prompts #8
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_slides#8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
we need two types of instructions
the fix keeps as much as possible the same just fixes it, and resolves instructions so it all works better
the rewrite is what we have now, this really redoes all based on what there is and bigger propmpt
add as 2 icons
confirm to me which model we use
test using browser mcp
Implementation Spec — Issue #8: Two Instruction Prompt Modes (Fix & Rewrite)
Objective
Add two distinct AI-powered instruction editing modes to the HeroSlides dashboard:
Both modes exposed as separate icon buttons in the instructions editor overlay.
Model Confirmed
Both fix and rewrite will use
Model::Gemini3ProPreviewviaherolib_ai, routed through OpenRouter usingOPENROUTER_API_KEY. (Theclaude-sonnet-4-20250514model is used separately bydeck.runAgentfor slide file generation — different operation.)Requirements
deck.fixInstructionsRPC method alongside existingdeck.rewriteInstructionscontent,deck_path) and return same shape ({ "content": "..." })bi-bandaid) + Rewrite (stars iconbi-stars)Files to Modify
crates/hero_slides_server/src/agent.rsFIX_SYSTEM_PROMPTconstant +handle_fix_instructions()crates/hero_slides_server/src/rpc.rsdeck.fixInstructionsdispatch armcrates/hero_slides_server/openrpc.jsondeck.fixInstructions+ missingdeck.rewriteInstructionsmethod entriescrates/hero_slides_ui/templates/index.htmlcrates/hero_slides_ui/static/js/dashboard.jsfixInstructions()function, wire up buttonImplementation Plan
Step 1 —
agent.rs: Add fix prompt and handlerFIX_SYSTEM_PROMPTconstant (surgical corrections only, no restructuring)handle_fix_instructions()— mirrorshandle_rewrite_instructions()but uses the fix promptStep 2 —
rpc.rs: Register new method"deck.fixInstructions" => crate::agent::handle_fix_instructions(&req.params).await,Step 3 —
openrpc.json: Document new methoddeck.fixInstructionsentry with params/result schemadeck.rewriteInstructionsentry for completenessStep 4 —
index.html: Add Fix button to UI<button id="btn-fix-instr" onclick="fixInstructions()">withbi-bandaidiconStep 5 —
dashboard.js: Add fixInstructions() functionrewriteInstructions()withdeck.fixInstructionsRPC, updated labels/button IDsAcceptance Criteria
deck.fixInstructions— returns minimal corrections onlydeck.rewriteInstructions— existing full-restructure behavioropenrpc.jsonincludesdeck.fixInstructionsschemaImplementation committed:
770dcfdBrowse:
770dcfdSummary
crates/hero_slides_server/src/agent.rs— AddedFIX_SYSTEM_PROMPTandhandle_fix_instructions()(mirrors rewrite handler with surgical fix prompt)crates/hero_slides_server/src/rpc.rs— Registereddeck.fixInstructionsdispatch armcrates/hero_slides_server/openrpc.json— Addeddeck.fixInstructionsanddeck.rewriteInstructionsmethod schemascrates/hero_slides_ui/templates/index.html— Added Fix button (bi-bandaidicon) before the Rewrite button in the instructions editor toolbarcrates/hero_slides_ui/static/js/dashboard.js— AddedfixInstructions()function wired to the new buttonModel used:
Gemini3ProPreviewvia OpenRouter for both fix and rewrite modes.Add Fix and Rewrite AI-powered buttons to the per-slide markdown editor overlay (`#editor-overlay`), mirroring the existing Fix/Rewrite feature already present in the instructions editor overlay.
Implementation Spec — Per-Slide Fix & Rewrite Buttons (Issue #8)
Objective
Add Fix and Rewrite AI-powered buttons to the per-slide markdown editor overlay (
#editor-overlay), mirroring the existing Fix/Rewrite feature already present in the instructions editor overlay.Requirements
slide.fixContentandslide.rewriteContent(params:content,deck_path,slide_name; returns{ "content": string })agent.rs:handle_fix_slide_contentandhandle_rewrite_slide_contentwith dedicated slide-scoped system promptsrpc.rsopenrpc.jsonfixSlideContent()andrewriteSlideContent()indashboard.js#editor-overlaytopbar inindex.html#editor-status, re-enable on completion, show toastFiles to Modify
crates/hero_slides_server/src/agent.rsFIX_SLIDE_SYSTEM_PROMPT,REWRITE_SLIDE_SYSTEM_PROMPT,handle_fix_slide_content(),handle_rewrite_slide_content()crates/hero_slides_server/src/rpc.rsslide.fixContentandslide.rewriteContentcrates/hero_slides_server/openrpc.jsoncrates/hero_slides_ui/templates/index.htmlbi-bandaid) and Rewrite (bi-stars) buttons to slide editor topbarcrates/hero_slides_ui/static/js/dashboard.jsfixSlideContent()andrewriteSlideContent()functionsImplementation Plan
Step 1: Add handlers in
agent.rsFIX_SLIDE_SYSTEM_PROMPT(surgical fix scoped to slide markdown format)REWRITE_SLIDE_SYSTEM_PROMPT(full rewrite scoped to slide markdown format)handle_fix_slide_content()andhandle_rewrite_slide_content()functionsStep 2: Add dispatch arms in
rpc.rs"slide.fixContent"and"slide.rewriteContent"match armsStep 3: Add OpenRPC schemas in
openrpc.jsonslide.fixContentandslide.rewriteContentmethod objectsStep 4: Add buttons in
index.htmlbi-bandaid) and Rewrite (bi-stars) buttons to#editor-overlayactionsStep 5: Add JS functions in
dashboard.jsfixSlideContent()andrewriteSlideContent()functionsAcceptance Criteria
slide.fixContent— minimal corrections onlyslide.rewriteContent— full restructureeditorDirty = trueand callupdateEditorPreview()after completionopenrpc.jsonincludes both new method schemasNotes
instrHistoryPushneededNN_slug.mdformat (title, bullets,## Visual direction)Gemini3ProPreviewvia OpenRouter (same as instructions handlers)slide_nameparam is optional, used for logging onlyTest Results
Build: pass
Tests: pass
test_generate_single_slide_ai— requires AI/external service)Build Fixes Applied
Three compilation errors were fixed before tests could run:
agent.rs: Raw string literalr#"..."#contained"##which is reserved in Rust 2024 — replaced withconcat!()macro.rpc.rs: Type inference failure onagent_jobs.read().await— added explicittokio::sync::RwLockReadGuardtype annotation.rpc.rs: Type inference failure onagent_jobs.write().await— added explicittokio::sync::RwLockWriteGuardtype annotation.Test Summary
hero_slides_libunit testshero_slides_libintegration testshero_slides_libdoc testshero_slides_rhaidoc testsImplementation Complete — Per-Slide Fix & Rewrite Buttons
Changes Made
crates/hero_slides_server/src/agent.rs— AddedFIX_SLIDE_SYSTEM_PROMPT,REWRITE_SLIDE_SYSTEM_PROMPT,handle_fix_slide_content(), andhandle_rewrite_slide_content()handler functions (after line 419, mirroring the existing instructions handlers)crates/hero_slides_server/src/rpc.rs— Added dispatch arms forslide.fixContent(line 105) andslide.rewriteContent(line 106)crates/hero_slides_server/openrpc.json— Addedslide.fixContentandslide.rewriteContentmethod schemas (afterslide.toInstructions)crates/hero_slides_ui/templates/index.html— Added Fix (bi-bandaid) and Rewrite (bi-stars) buttons to the#editor-overlaytoolbar (lines 376–381)crates/hero_slides_ui/static/js/dashboard.js— AddedfixSlideContent()(line 2186) andrewriteSlideContent()(line 2236) functions following the exact pattern of the instructions variantsTest Results
Notes
NN_slug.mdwith## Visual directionsection)Gemini3ProPreviewvia OpenRouterImplementation committed:
139b076Browse:
139b076