Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: move media prompt analysis into media gen

[._.]/ Adam Eivy8726cfb00fe3
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 9849a86064..dd42c11963 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -47,6 +47,7 @@ const Ask = lazyWithReload(() => import('./pages/Ask'));
const MediaGen = lazyWithReload(() => import('./pages/MediaGen'));
const ImageGen = lazyWithReload(() => import('./pages/ImageGen'));
const VideoGen = lazyWithReload(() => import('./pages/VideoGen'));
+const PromptFromMediaPage = lazyWithReload(() => import('./pages/PromptFromMediaPage'));
const MediaHistory = lazyWithReload(() => import('./pages/MediaHistory'));
const MediaAnnotate = lazyWithReload(() => import('./pages/MediaAnnotate'));
const MediaCollections = lazyWithReload(() => import('./pages/MediaCollections'));
@@ -466,6 +467,7 @@ export default function App() {
<Route index element={<Navigate to="/media/image" replace />} />
<Route path="image" element={<ImageGen />} />
<Route path="video" element={<RedirectWithSearch to="/video/generate" />} />
+ <Route path="prompt" element={<PromptFromMediaPage />} />
<Route path="history" element={<MediaHistory />} />
<Route path="annotate" element={<MediaAnnotate />} />
<Route path="annotate/:mediaKey" element={<MediaAnnotate />} />
diff --git a/client/src/components/media/MediaLightbox.jsx b/client/src/components/media/MediaLightbox.jsx
index bf660655c8..1d6ca2c5c7 100644
--- a/client/src/components/media/MediaLightbox.jsx
+++ b/client/src/components/media/MediaLightbox.jsx
@@ -118,6 +118,7 @@ export default function MediaLightbox({
annotation = null,
onAnnotationChange,
onPromptChange,
+ onPromptAnalysis,
variantGroup = null,
onSelectVariant,
}) {
@@ -440,7 +441,7 @@ export default function MediaLightbox({
)}
</div>
<PromptRefineModal item={item} open={refineOpen} onClose={() => setRefineOpen(false)} />
- <PromptFromMediaModal item={item} open={promptFromOpen} onClose={() => setPromptFromOpen(false)} />
+ <PromptFromMediaModal item={item} open={promptFromOpen} onClose={() => setPromptFromOpen(false)} onResult={onPromptAnalysis} />
</div>,
document.body
);
@@ -766,7 +767,7 @@ function SettingsPane({
title="Ask a vision model to write the image and/or video prompt that would recreate this"
className="flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs bg-port-accent/80 text-white hover:opacity-90 rounded"
>
- <ScanEye className="w-3.5 h-3.5" /> Prompt from this
+ <ScanEye className="w-3.5 h-3.5" /> {item.prompt && item.prompt !== '(no prompt)' ? 'Prompt from this' : 'Analyze prompt'}
</button>
)}
{onRemix && (
diff --git a/client/src/components/media/MediaPreview.jsx b/client/src/components/media/MediaPreview.jsx
index f775771073..7c68e861f7 100644
--- a/client/src/components/media/MediaPreview.jsx
+++ b/client/src/components/media/MediaPreview.jsx
@@ -108,6 +108,10 @@ export default function MediaPreview({
onPromptSaved?.(item, nextPrompt);
return result;
}, [onPromptSaved]);
+ const handlePromptAnalysis = useCallback((item, result) => {
+ const prompt = item.kind === 'video' ? result?.videoPrompt : result?.imagePrompt;
+ if (prompt) savePrompt(item, prompt).catch(() => {});
+ }, [savePrompt]);
return (
<MediaLightbox
item={displayedPreview}
@@ -117,6 +121,7 @@ export default function MediaPreview({
onPromptChange={savePrompt}
variantGroup={variantGroup}
onSelectVariant={onSelectVariant}
+ onPromptAnalysis={handlePromptAnalysis}
{...handlers}
{...navProps}
/>
diff --git a/client/src/pages/MediaGen.jsx b/client/src/pages/MediaGen.jsx
index 9cb98c9a23..17b7a3e6a0 100644
--- a/client/src/pages/MediaGen.jsx
+++ b/client/src/pages/MediaGen.jsx
@@ -1,5 +1,5 @@
import { useNavigate, useLocation, Outlet } from 'react-router';
-import { Layers, Image as ImageIcon, Film, History, Scissors, FolderOpen, Box, Pencil } from 'lucide-react';
+import { Layers, Image as ImageIcon, Film, History, Scissors, FolderOpen, Box, Pencil, ScanEye } from 'lucide-react';
import TabPills from '../components/ui/TabPills';
import { getPageNavTabs } from '../../../server/lib/navManifest.js';
import { buildPageNavTabs } from '../lib/pageNavTabs.js';
@@ -14,6 +14,7 @@ import { buildPageNavTabs } from '../lib/pageNavTabs.js';
const TAB_PRESENTATION = {
image: { icon: ImageIcon },
video: { icon: Film },
+ prompt: { icon: ScanEye },
threejs: { icon: Box },
annotate: { icon: Pencil },
timeline: { icon: Scissors },
diff --git a/client/src/pages/MediaGen.test.jsx b/client/src/pages/MediaGen.test.jsx
index 64bc893d46..c12acd18d4 100644
--- a/client/src/pages/MediaGen.test.jsx
+++ b/client/src/pages/MediaGen.test.jsx
@@ -42,7 +42,7 @@ describe('<MediaGen>', () => {
describe('MediaGen TABS ↔ nav manifest', () => {
it('renders the media tabGroup in page order with a presentation entry each', () => {
expectPageNavTabs(TABS, [
- 'image:Image', 'video:Video', 'threejs:Three.js', 'annotate:Annotate',
+ 'image:Image', 'video:Video', 'prompt:Prompt', 'threejs:Three.js', 'annotate:Annotate',
'timeline:Timeline', 'history:History', 'collections:Collections',
]);
});
diff --git a/client/src/pages/PromptFromMediaPage.jsx b/client/src/pages/PromptFromMediaPage.jsx
new file mode 100644
index 0000000000..0fd33ce8e5
--- /dev/null
+++ b/client/src/pages/PromptFromMediaPage.jsx
@@ -0,0 +1,19 @@
+import { ScanEye } from 'lucide-react';
+import PromptFromMedia from '../components/media/PromptFromMedia';
+
+export default function PromptFromMediaPage() {
+ return (
+ <div className="max-w-4xl mx-auto space-y-4">
+ <div className="flex items-center gap-2">
+ <ScanEye className="w-5 h-5 text-port-accent" />
+ <div>
+ <h2 className="text-lg font-semibold text-white">Prompt from media</h2>
+ <p className="text-xs text-gray-400">Analyze an image or video and turn it into an editable generation prompt.</p>
+ </div>
+ </div>
+ <div className="bg-port-card border border-port-border rounded-xl p-4">
+ <PromptFromMedia kindDefault="both" alwaysOpen />
+ </div>
+ </div>
+ );
+}
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index dfa7c5bdd3..c27497b497 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -61,7 +61,6 @@ import VideoUpscaleDrawer from '../components/media/VideoUpscaleDrawer';
import StylePresetPicker from '../components/media/StylePresetPicker';
import UniverseStylePicker from '../components/media/UniverseStylePicker';
import PromptEnhancer from '../components/media/PromptEnhancer';
-import PromptFromMedia from '../components/media/PromptFromMedia';
import { normalizeVideo } from '../components/media/normalize';
import {
Film, Sparkles, Settings as SettingsIcon, RefreshCw, AlertTriangle,
@@ -1842,17 +1841,6 @@ export default function VideoGen() {
</details>
</div>
- <div className="bg-port-card border border-port-border rounded-xl p-4 space-y-3">
- <h2 className="text-xs font-medium text-gray-400 uppercase tracking-wide">Prompt from media</h2>
- <PromptFromMedia
- kindDefault="both"
- applyKind="video"
- setPrompt={setPrompt}
- setNegativePrompt={negativePromptSupported ? setNegativePrompt : undefined}
- maxVideoPromptLength={enhancePromptBudget}
- alwaysOpen
- />
- </div>
</form>
<RenderStatusCard
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index a37aea8dde..b8fbe8342e 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -47,6 +47,7 @@ const RAW_NAV_COMMANDS = [
{ id: 'nav.media', path: '/media', label: 'Media Gen', section: 'Create', aliases: ['media', 'media-gen', 'mediagen', 'generate'], keywords: ['image', 'video', 'render', 'art', 'movie'] },
{ id: 'nav.media.image', path: '/media/image', label: 'Image', section: 'Create', tabGroup: 'media', tabId: 'image', previousPaths: ['/image-gen'], aliases: ['image-gen', 'imagegen', 'generate-image', 'sd', 'stable-diffusion'], keywords: ['stable diffusion', 'render', 'art', 'picture', 'photo', 'draw', 'flux', 'mflux'] },
{ id: 'nav.media.video', path: '/video/generate', label: 'Generate Video', tabLabel: 'Video', section: 'Create', tabGroup: 'media', tabId: 'video', previousPaths: ['/video-gen', '/media/video'], aliases: ['video-gen', 'videogen', 'generate-video', 'ltx'], keywords: ['video', 'animate', 'movie', 'clip', 'ltx', 'episode composer', 'continuous video', 'multi-scene'] },
+ { id: 'nav.media.prompt', path: '/media/prompt', label: 'Prompt from Media', tabLabel: 'Prompt', section: 'Create', tabGroup: 'media', tabId: 'prompt', aliases: ['prompt-from-media', 'analyze-media-prompt'], keywords: ['vision', 'reverse prompt', 'describe media', 'image prompt', 'video prompt'] },
{ id: 'nav.media.threejs', path: '/media/threejs', label: 'Three.js Models', section: 'Create', tabGroup: 'media', tabId: 'threejs', tabLabel: 'Three.js', aliases: ['threejs', 'three-js', '3d-models', 'image-to-3d', 'img2threejs'], keywords: ['procedural', '3d', 'mesh', 'model', 'gallery', 'webgl', 'preview'] },
{ id: 'nav.media.annotate', path: '/media/annotate', label: 'Annotate', section: 'Create', tabGroup: 'media', tabId: 'annotate', previousPaths: ['/annotate', '/annotate/:mediaKey'], aliases: ['annotate', 'media-annotate', 'sketch', 'draw-over', 'markup'], keywords: ['annotation', 'sketch', 'draw', 'markup', 'scribble', 'label', 'canvas', 'overlay', 'stroke'] },
{ id: 'nav.media.timeline', path: '/media/timeline', label: 'Timeline', section: 'Create', tabGroup: 'media', tabId: 'timeline', aliases: ['timeline', 'video-timeline', 'editor'], keywords: ['edit', 'trim', 'composite', 'stitch', 'cut', 'compose'] },