Browse Source

feat: add audio type to API types and connection wiring

Add generateAudio to getNodeHandles() for connection validation, wire
audio handle type in connection drop menu, and add "audio" mediaType
to GenerateRequest/GenerateResponse API types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
handoff-20260429-1057
shrimbly 5 months ago
parent
commit
4ab1b89ed9
  1. 8
      src/components/WorkflowCanvas.tsx
  2. 6
      src/types/api.ts

8
src/components/WorkflowCanvas.tsx

@ -124,6 +124,8 @@ const getNodeHandles = (nodeType: string): { inputs: string[]; outputs: string[]
return { inputs: ["image", "text"], outputs: ["video"] };
case "generate3d":
return { inputs: ["image", "text"], outputs: ["3d"] };
case "generateAudio":
return { inputs: ["text"], outputs: ["audio"] };
case "llmGenerate":
return { inputs: ["text", "image"], outputs: ["text"] };
case "splitGrid":
@ -810,7 +812,7 @@ export function WorkflowCanvas() {
sourceHandleIdForNewNode = "image";
}
} else if (handleType === "text") {
if (nodeType === "nanoBanana" || nodeType === "generateVideo" || nodeType === "llmGenerate") {
if (nodeType === "nanoBanana" || nodeType === "generateVideo" || nodeType === "generateAudio" || nodeType === "llmGenerate") {
targetHandleId = "text";
// llmGenerate also has a text output
if (nodeType === "llmGenerate") {
@ -841,6 +843,10 @@ export function WorkflowCanvas() {
if (nodeType === "audioInput") {
// AudioInput outputs audio
sourceHandleIdForNewNode = "audio";
} else if (nodeType === "generateAudio") {
// GenerateAudio outputs audio
sourceHandleIdForNewNode = "audio";
targetHandleId = "text";
} else if (nodeType === "videoStitch") {
// VideoStitch accepts audio
targetHandleId = "audio";

6
src/types/api.ts

@ -16,7 +16,7 @@ export interface GenerateRequest {
resolution?: Resolution; // Only for Nano Banana Pro
model?: ModelType;
useGoogleSearch?: boolean; // Only for Nano Banana Pro
mediaType?: "image" | "video" | "3d"; // Indicates expected output type for provider routing
mediaType?: "image" | "video" | "3d" | "audio"; // Indicates expected output type for provider routing
}
export interface GenerateResponse {
@ -24,8 +24,10 @@ export interface GenerateResponse {
image?: string;
video?: string;
videoUrl?: string; // For large videos, return URL directly
audio?: string; // Base64 audio data
audioUrl?: string; // For large audio, return URL directly
model3dUrl?: string; // For 3D models, return GLB URL directly
contentType?: "image" | "video" | "3d";
contentType?: "image" | "video" | "3d" | "audio";
error?: string;
}

Loading…
Cancel
Save