feat: enhance canvas functionality with new node types and improved data handling

- Added support for a new "compare" node type to facilitate side-by-side image comparisons.
- Updated AI image and prompt nodes to include aspect ratio handling for better image generation.
- Enhanced canvas toolbar to include export functionality for canvas data.
- Improved data resolution for compare nodes by resolving incoming edges and updating node data accordingly.
- Refactored frame node to support dynamic resizing and exporting capabilities.
- Introduced debounced saving for prompt node to optimize performance during user input.
This commit is contained in:
Matthias
2026-03-25 21:33:22 +01:00
parent fffdae3a9c
commit da6529f263
19 changed files with 1801 additions and 122 deletions

View File

@@ -24,6 +24,8 @@ export interface GenerateImageParams {
prompt: string;
referenceImageUrl?: string; // optional image-to-image input
model?: string;
/** OpenRouter image_config.aspect_ratio e.g. "16:9", "1:1" */
aspectRatio?: string;
}
export interface OpenRouterImageResponse {
@@ -59,7 +61,7 @@ export async function generateImageViaOpenRouter(
text: params.prompt,
});
const body = {
const body: Record<string, unknown> = {
model: modelId,
modalities: ["image", "text"],
messages: [
@@ -70,6 +72,12 @@ export async function generateImageViaOpenRouter(
],
};
if (params.aspectRatio?.trim()) {
body.image_config = {
aspect_ratio: params.aspectRatio.trim(),
};
}
const response = await fetch(`${OPENROUTER_BASE_URL}/chat/completions`, {
method: "POST",
headers: {