diff --git a/frontend/src/config/pages/content.config.tsx b/frontend/src/config/pages/content.config.tsx
index bfd673e7..fb95bcd6 100644
--- a/frontend/src/config/pages/content.config.tsx
+++ b/frontend/src/config/pages/content.config.tsx
@@ -102,7 +102,7 @@ export const createContentPageConfig = (
render: (value: string, row: Content) => (
- {row.meta_title || row.title || row.task_title || `Task #${row.task}`}
+ {row.meta_title || row.title || row.task_title || `Task #${row.task_id}`}
{row.meta_description && (
diff --git a/frontend/src/config/pages/table-actions.config.tsx b/frontend/src/config/pages/table-actions.config.tsx
index 53998537..50ef6727 100644
--- a/frontend/src/config/pages/table-actions.config.tsx
+++ b/frontend/src/config/pages/table-actions.config.tsx
@@ -257,6 +257,12 @@ const tableActionsConfigs: Record
= {
icon: EditIcon,
variant: 'primary',
},
+ {
+ key: 'generate_images',
+ label: 'Generate Images',
+ icon: ,
+ variant: 'primary',
+ },
],
bulkActions: [
{
@@ -271,12 +277,6 @@ const tableActionsConfigs: Record = {
icon: ,
variant: 'secondary',
},
- {
- key: 'generate_images',
- label: 'Generate Images',
- icon: ,
- variant: 'secondary',
- },
{
key: 'publish',
label: 'Publish Selected',
diff --git a/frontend/src/pages/Writer/Content.tsx b/frontend/src/pages/Writer/Content.tsx
index a12fd292..cff1c9ba 100644
--- a/frontend/src/pages/Writer/Content.tsx
+++ b/frontend/src/pages/Writer/Content.tsx
@@ -9,6 +9,7 @@ import {
fetchContent,
Content as ContentType,
ContentFilters,
+ autoGenerateImages,
} from '../../services/api';
import { useToast } from '../../components/ui/toast/ToastContainer';
import { FileIcon } from '../../icons';
@@ -145,6 +146,32 @@ export default function Content() {
}));
}, [pageConfig?.headerMetrics, content, totalCount]);
+ const handleRowAction = useCallback(async (action: string, row: ContentType) => {
+ if (action === 'generate_images') {
+ const taskId = row.task_id;
+ if (!taskId) {
+ toast.error('No task linked to this content for image generation');
+ return;
+ }
+
+ try {
+ const result = await autoGenerateImages([taskId]);
+
+ if (result.success) {
+ if (result.task_id) {
+ toast.success('Image generation started');
+ } else {
+ toast.success(`Image generation complete: ${result.images_created || 0} image${(result.images_created || 0) === 1 ? '' : 's'} generated`);
+ }
+ } else {
+ toast.error(result.error || 'Failed to generate images');
+ }
+ } catch (error: any) {
+ toast.error(`Failed to generate images: ${error.message}`);
+ }
+ }
+ }, [toast]);
+
return (
<>
row.meta_title || row.title || `Content #${row.id}`}
/>
>
diff --git a/frontend/src/services/api.ts b/frontend/src/services/api.ts
index a783e0fa..ff4dc10d 100644
--- a/frontend/src/services/api.ts
+++ b/frontend/src/services/api.ts
@@ -1464,7 +1464,7 @@ export interface ContentFilters {
export interface Content {
id: number;
- task: number;
+ task_id: number;
task_title?: string | null;
sector_name?: string | null;
title?: string | null;