AI media harness for planning, generating, and editing locally
TypeScript
Add template debug prompt previews
Bitti6a4d233a02ea
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 7d344fe..4607a06 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -33,6 +33,7 @@ This alpha update adds LAN generation workers, Linux support, expanded color gra## Fixes and improvements- Click a work queue job to open its image, scene, reference, generator download or export. Navigation works across projects and preserves unsaved project edits.+- Character Sheet and Extend offer Debug prompt when debug options are enabled. Character Sheet exposes the separate compiled prompt for each of its four views.- Updated the bundled SlopFab runtime to API 1.18 for refmod export and support for version-5 refmod bundles.- LAN workers select weight downloads using their own GPU type and VRAM, even when a different variant is already downloaded on the client.- Continue preserves the full joined video and audio from Slopfab. Adjacent source and continuation scenes use that shared decode in preview and export, preserving context across the cut. Regenerate older Continue scenes to apply the fix.diff --git a/src/components/workspace/CharacterSheetSettings.tsx b/src/components/workspace/CharacterSheetSettings.tsxindex bc44e1b..9a689fb 100644--- a/src/components/workspace/CharacterSheetSettings.tsx+++ b/src/components/workspace/CharacterSheetSettings.tsx@@ -1,9 +1,10 @@import { useMemo, useState } from "react";-import { CHARACTER_SHEET_HEIGHTS, characterSheetDimensions, compileCharacterSheet, emptyCharacterSheetOptions, type CharacterSheetOptions } from "../../lib/characterSheet";+import { CHARACTER_SHEET_HEIGHTS, CHARACTER_SHEET_ORDER, CHARACTER_SHEET_VIEWS, characterSheetDimensions, compileCharacterSheet, emptyCharacterSheetOptions, type CharacterSheetOptions } from "../../lib/characterSheet";import type { ProjectAsset, ProjectConfig } from "../../lib/project";import { ComboBox, InfoBar, ItemHeader, PropRow } from "../ui";import { Dismiss16, Sparkle16 } from "../ui/icons";import { PromptTextField, type PromptReference } from "./PromptTextField";+import { TemplateDebugPrompt } from "./TemplateDebugPrompt";export function CharacterSheetSettings({ config, source, references, missingLabel, defaultSteps, disabledReason, busy, onExecute, onClose }: {config: ProjectConfig; source: ProjectAsset; references: PromptReference[]; missingLabel: (id: string) => string;@@ -14,10 +15,11 @@ export function CharacterSheetSettings({ config, source, references, missingLabesteps: config.imageScene?.steps ?? defaultSteps, seed: config.imageScene?.seed ?? -1 }));const dimensions = characterSheetDimensions(config.settings.resolution, options.height);const [error, setError] = useState<string | null>(null);- const validation = useMemo(() => {- try { compileCharacterSheet(config, source, "cache/character-sheet-preview/1.png", options); return null; }- catch (reason) { return reason instanceof Error ? reason.message : String(reason); }+ const compiled = useMemo(() => {+ try { return { views: compileCharacterSheet(config, source, "cache/character-sheet-preview/1.png", options), error: null }; }+ catch (reason) { return { views: null, error: reason instanceof Error ? reason.message : String(reason) }; }}, [config, source, options]);+ const validation = compiled.error;const update = <K extends keyof CharacterSheetOptions,>(field: K, value: CharacterSheetOptions[K]) => {setOptions((current) => ({ ...current, [field]: value })); setError(null);};@@ -47,6 +49,7 @@ export function CharacterSheetSettings({ config, source, references, missingLabe{(validation || error) && <InfoBar severity="error" title="Couldn't prepare the template" message={validation ?? error ?? ""} />}</div><div className="image-template-settings__footer">+ <TemplateDebugPrompt name="Character sheet" prompts={compiled.views ? CHARACTER_SHEET_ORDER.map((index) => ({ label: CHARACTER_SHEET_VIEWS[index].label, prompt: compiled.views![index].prompt })) : []} />{disabledReason && <p className="image-inspector__caption">{disabledReason}</p>}<button type="submit" className="primary-button" disabled={Boolean(disabledReason || validation || busy)}><Sparkle16 aria-hidden="true" />{busy ? "Executing…" : "Execute"}</button></div>diff --git a/src/components/workspace/DebugPromptDialog.tsx b/src/components/workspace/DebugPromptDialog.tsxindex 247d7e5..2bbe923 100644--- a/src/components/workspace/DebugPromptDialog.tsx+++ b/src/components/workspace/DebugPromptDialog.tsx@@ -1,21 +1,23 @@-import { useRef } from "react";+import { useRef, type ReactNode } from "react";import type { PromptSegment } from "../../lib/project";import { ContentDialog } from "../ui";/** The exact prompt the engine is sent, in a ContentDialog. Ctrl+A inside the* prompt selects the prompt alone (not the whole window), so it can be* copied in one go. */-export function DebugPromptDialog({ sceneTitle, segments, onClose, title = "Debug prompt", promptLabel = "The compiled MiniMax H3 prompt" }: {+export function DebugPromptDialog({ sceneTitle, segments, onClose, title = "Debug prompt", promptLabel = "The compiled MiniMax H3 prompt", controls }: {sceneTitle: string;segments: PromptSegment[];onClose: () => void;title?: string;promptLabel?: string;+ controls?: ReactNode;}) {const prompt = useRef<HTMLPreElement>(null);return <ContentDialog title={title} closeText="Close" onClose={onClose} width={880} className="debug-prompt-dialog" initialFocus={prompt}><p className="debug-prompt-dialog__scene">{sceneTitle}</p>+ {controls}{/* Render compiler segments directly to preserve the exact engine prompt. */}<preref={prompt}diff --git a/src/components/workspace/ExtendSettings.tsx b/src/components/workspace/ExtendSettings.tsxindex 01b7d7e..0a83335 100644--- a/src/components/workspace/ExtendSettings.tsx+++ b/src/components/workspace/ExtendSettings.tsx@@ -4,6 +4,7 @@ import type { ProjectAsset, ProjectConfig } from "../../lib/project";import { InfoBar, ItemHeader, PropRow } from "../ui";import { Dismiss16, Sparkle16 } from "../ui/icons";import { PromptTextField, type PromptReference } from "./PromptTextField";+import { TemplateDebugPrompt } from "./TemplateDebugPrompt";export function ExtendSettings({ config, source, options, onChange, references, missingLabel, busy, disabledReason, onExecute, onClose }: {config: ProjectConfig; source: ProjectAsset; options: ExtendOptions; onChange: (options: ExtendOptions) => void;@@ -11,8 +12,11 @@ export function ExtendSettings({ config, source, options, onChange, references,onExecute: () => void; onClose: () => void;}) {const validation = useMemo(() => {- try { return { output: compileExtendImage(config, source, "cache/extend-preview.png", options).layout.output, message: null }; }- catch (reason) { return { output: null, message: reason instanceof Error ? reason.message : String(reason) }; }+ try {+ const compiled = compileExtendImage(config, source, "cache/extend-preview.png", options);+ return { output: compiled.layout.output, prompt: compiled.prompt, message: null };+ }+ catch (reason) { return { output: null, prompt: null, message: reason instanceof Error ? reason.message : String(reason) }; }}, [config, source, options]);return <aside className="image-inspector image-template-settings" aria-label="Extend settings"><ItemHeader name="Extend" meta="Template" actions={<button type="button" className="icon-button" aria-label="Close template settings" data-tooltip="Back to image settings" onClick={onClose}><Dismiss16 aria-hidden="true" /></button>} />@@ -40,6 +44,7 @@ export function ExtendSettings({ config, source, options, onChange, references,{validation.message && <InfoBar severity="error" title="Adjust the Extend settings" message={validation.message} />}</div><div className="image-template-settings__footer">+ <TemplateDebugPrompt name="Extend" prompts={validation.prompt === null ? [] : [{ label: "Extend", prompt: validation.prompt }]} />{disabledReason && <p className="image-inspector__caption">{disabledReason}</p>}<button type="submit" className="primary-button" disabled={busy || Boolean(disabledReason || validation.message)}><Sparkle16 aria-hidden="true" />{busy ? "Executing…" : "Execute"}</button></div>diff --git a/src/components/workspace/TemplateDebugPrompt.tsx b/src/components/workspace/TemplateDebugPrompt.tsxnew file mode 100644index 0000000..c483719--- /dev/null+++ b/src/components/workspace/TemplateDebugPrompt.tsx@@ -0,0 +1,25 @@+import { useEffect, useState, useSyncExternalStore } from "react";+import { loadDebugOptionsEnabled, subscribeDebugOptions } from "../../lib/settings";+import { ComboBox } from "../ui";+import { DebugPromptDialog } from "./DebugPromptDialog";++/** Template previews use the same compiler output as the generation queue. */+export function TemplateDebugPrompt({ name, prompts }: {+ name: string;+ prompts: Array<{ label: string; prompt: string }>;+}) {+ const enabled = useSyncExternalStore(subscribeDebugOptions, loadDebugOptionsEnabled);+ const [open, setOpen] = useState(false);+ const [selected, setSelected] = useState(0);+ useEffect(() => { if (!enabled || !prompts.length) setOpen(false); }, [enabled, prompts.length]);+ if (!enabled) return null;+ const index = Math.min(selected, prompts.length - 1);+ const current = prompts[index];+ return <>+ <button type="button" className="secondary-button debug-prompt__toggle" aria-haspopup="dialog" disabled={!current}+ onClick={() => { setSelected(0); setOpen(true); }}>Debug prompt</button>+ {open && current && <DebugPromptDialog sceneTitle={name} segments={[{ kind: "brief", value: current.prompt }]} onClose={() => setOpen(false)}+ controls={prompts.length > 1 && <ComboBox aria-label="Template view" value={index} onChange={setSelected}+ options={prompts.map(({ label }, value) => ({ label, value }))} />} />}+ </>;+}