Skip to content

Canvas + Improvements#31

Open
mblanc wants to merge 26 commits intomainfrom
improvements
Open

Canvas + Improvements#31
mblanc wants to merge 26 commits intomainfrom
improvements

Conversation

@mblanc
Copy link
Copy Markdown
Owner

@mblanc mblanc commented Apr 3, 2026

No description provided.

mblanc and others added 26 commits March 15, 2026 21:56
- Replaced manual resizing logic with a reusable `useNodeResize` hook in CustomWorkflowNode, FileNode, ImageNode, ListNode, LLMNode, ResizeNode, TextNode, UpscaleNode, and VideoNode.
- Enhanced state management for dimensions and resizing behavior, improving code maintainability and readability.
- Updated components to utilize synced state for text and prompt management, ensuring consistent data handling.

This refactor enhances the user experience by providing a more consistent and efficient resizing mechanism across various node types.
…nd LLMs

- Introduced `CustomWorkflowConfig`, `FileConfig`, `ImageConfig`, and `LLMConfig` components to manage node-specific settings.
- Implemented dynamic fetching of signed URLs for file and image nodes, enhancing user experience with previews.
- Added schema editing capabilities in `SchemaEditor` for LLM nodes, allowing for flexible response structures.
- Enhanced state management and UI components for better integration with existing node functionalities.

This commit significantly improves the configurability and usability of nodes within the flow canvas, providing users with more control over their workflows.
….ts`) should export its own `NodeDefinition`, input gathering, and execution logic. `node-registry.ts` should only collect and register these.
- Updated FlowDocument and CustomNodeDocument interfaces to use PersistedNode and PersistedEdge types for better type safety.
- Changed createdAt and updatedAt fields to ISO 8601 string format for consistent timestamp handling.
- Improved schemas to define portDefaultValue with specific types, enhancing validation.
- Refactored node registration logic to simplify type handling and removed unused imports in node-helpers.

These changes improve type safety and consistency across the application, facilitating better data management and integration with Firestore.
- Replaced direct API calls for signed URLs with a caching mechanism using `fetchAndCacheSignedUrl` in `FlowsList`, `BatchMediaGallery`, and `useSignedUrl` hooks.
- Improved initial state setup for signed URLs to utilize cached values, reducing redundant fetches and enhancing performance.
- Updated `FlowCanvas` to adjust rendering behavior for visible elements.

These changes streamline the handling of signed URLs, improving efficiency and user experience across the application.
…Callback`, and clean up unused variables and imports across tests and components.
…orage services to throw errors instead of returning null on failure.
- Replaced direct string checks for GCS URIs with a utility function `isGcsUri` in `custom-workflow-node`, `file-node`, `list-node`, and `image-config` components to improve code readability and maintainability.
- Introduced `parseGcsUri` and `extractBucketFromStorageUri` functions in the storage module to enhance GCS URI parsing logic.
- Updated constants to include `IMAGE_MODEL_CONFIGS` for better organization of image model configurations.

These changes enhance the clarity and efficiency of GCS URI management throughout the application.
- Deleted `lint-output.txt` and `lint-results.txt` as they are no longer needed, streamlining the project structure and reducing clutter.
- Updated import paths for various components to reflect their new locations within the project structure, improving clarity and maintainability.
- Introduced a new `FloatingNodePalette` component to manage node addition in the flow canvas, enhancing user experience.
- Added `FlowCanvas`, `FlowContextMenu`, and `FlowRunPanel` components to streamline flow management and interactions.
- Refactored existing tests to align with the updated component structure, ensuring comprehensive coverage and reliability.
- Added functionality to create and delete canvases, enhancing the flow management experience.
- Introduced a new Canvas interface to manage canvas data effectively.
- Updated data fetching logic to include canvases when the active tab is set to "canvas".
- Enhanced rendering logic to accommodate canvas items alongside flows and custom nodes.
- Updated constants to include CANVASES for better organization.
…pendencies

- Integrated a new `CanvasChatPanel` component into the `CanvasEditor`, improving user interaction.
- Updated `package.json` and `package-lock.json` to include `react-markdown` and `remark-gfm` for enhanced markdown support.
- Refactored type imports in various components for better readability and consistency.
- Cleaned up input change handlers in node components for improved code clarity.
… states

- Added media generation capabilities to the `CanvasChatInput`, allowing for image and video creation based on user input.
- Integrated loading state handling in `CanvasChatMessages` to improve user experience during chat interactions.
- Updated `CanvasChatPanel` and `CanvasEditor` to pass viewport center functionality, enhancing layout responsiveness.
- Refactored type imports and added new types for better clarity and maintainability in the chat components.
- Simplified the enqueue logic in the chat route for better readability.
- Improved the CanvasChatInput component by adding mention handling and attachment management features.
- Introduced state management for mentions and dismissed attachments, enhancing user interaction.
- Utilized memoization for performance optimization in mention and attachment processing.
- Updated the canvas agent to better reference shared items in user interactions.
- Added logging for unknown event types in the chat API to improve debugging.
- Updated CanvasChatInput to handle action prompts, allowing users to trigger specific actions from chat messages.
- Enhanced CanvasChatMessage to display action buttons for user interactions, improving engagement.
- Refactored media generation logic to include reference images, streamlining video creation from existing content.
- Introduced new state management for pending action prompts in the canvas store, enhancing user experience.
- Replaces Gemini 3 Pro Preview with Gemini 3.1 Pro Preview across the application.
- Adds support for the Veo 3.1 Lite video generation model in constants and schemas.
- Synchronizes package-lock.json with recent dependency state.
…ation

- Introduced a new `generateAudio` boolean property in the media generation interface to control audio generation alongside video.
- Updated the CanvasChatInput and related logic to handle the new audio generation feature, defaulting to false unless explicitly requested by the user.
- Removed unused mode icon logic from CanvasChatInput to streamline the component.
- Adjusted CanvasToolbar styles for a more modern appearance and consistent button shapes.
- Simplified node title layers in CanvasImageNode, CanvasTextNode, and CanvasVideoNode by removing background styles for a cleaner look.
- Updated the main container style in CanvasTextNode for better visual integration.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new 'Canvas' feature, providing a free-form workspace for media generation and arrangement using an AI agent. It includes the necessary API routes, a Zustand-based store for canvas state, and new React components for the canvas editor, chat panel, and media nodes. Additionally, it adds utility hooks for node resizing, signed URL caching, and state synchronization. I have no further feedback to provide as the changes are well-structured and align with the project's architecture.

@mblanc
Copy link
Copy Markdown
Owner Author

mblanc commented Apr 3, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the 'Canvas' feature, an admin-only creative workspace for generating and arranging AI media assets via a conversational agent. The update includes new API routes for canvas CRUD and chat streaming, a dedicated Zustand store, and specialized canvas node components. It also refactors existing node logic into a modular structure and adds a signed URL cache to optimize media rendering. Feedback focuses on improving type safety by replacing 'any' types and assertions with proper interfaces and discriminated unions, and suggests adding a timeout mechanism to chat fetch requests for better robustness.

@@ -1,6 +1,8 @@
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Avoid using eslint-disable for no-explicit-any. Instead, define proper interfaces or types for the mocked objects to maintain type safety.

@@ -0,0 +1,97 @@
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Avoid using eslint-disable for no-explicit-any. Define proper types for the node data to improve maintainability and type safety.

@@ -0,0 +1,99 @@
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Avoid using eslint-disable for no-explicit-any. Define proper types for the node data to improve maintainability and type safety.

@@ -0,0 +1,88 @@
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Avoid using eslint-disable for no-explicit-any. Define proper types for the node data to improve maintainability and type safety.

@@ -0,0 +1,88 @@
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Avoid using eslint-disable for no-explicit-any. Define proper types for the node data to improve maintainability and type safety.

break;
default:
logger.warn(
`[ChatAPI] Unknown event type: ${(event as { type: string }).type}`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Avoid using type assertion (event as { type: string }).type. Define a proper discriminated union type for AgentEvent to ensure type safety.

});
toast.error(message);
} finally {
setIsChatLoading(false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The chat request is missing a timeout mechanism. Consider adding a timeout to the fetch request to prevent hanging connections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant