Browse Source
Create api.ts with GenerateRequest, GenerateResponse, LLMGenerateRequest, LLMGenerateResponse. Move RecentModel to providers.ts. Convert index.ts to pure re-export hub with no type definitions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>handoff-20260429-1057
3 changed files with 62 additions and 48 deletions
@ -0,0 +1,44 @@ |
|||||
|
/** |
||||
|
* API Types |
||||
|
* |
||||
|
* Request and response types for API routes including |
||||
|
* image generation and LLM text generation. |
||||
|
*/ |
||||
|
|
||||
|
import type { AspectRatio, Resolution, ModelType } from "./models"; |
||||
|
import type { LLMProvider, LLMModelType } from "./providers"; |
||||
|
|
||||
|
// API Request/Response types for Image Generation
|
||||
|
export interface GenerateRequest { |
||||
|
images: string[]; // Now supports multiple images
|
||||
|
prompt: string; |
||||
|
aspectRatio?: AspectRatio; |
||||
|
resolution?: Resolution; // Only for Nano Banana Pro
|
||||
|
model?: ModelType; |
||||
|
useGoogleSearch?: boolean; // Only for Nano Banana Pro
|
||||
|
} |
||||
|
|
||||
|
export interface GenerateResponse { |
||||
|
success: boolean; |
||||
|
image?: string; |
||||
|
video?: string; |
||||
|
videoUrl?: string; // For large videos, return URL directly
|
||||
|
contentType?: "image" | "video"; |
||||
|
error?: string; |
||||
|
} |
||||
|
|
||||
|
// API Request/Response types for LLM Text Generation
|
||||
|
export interface LLMGenerateRequest { |
||||
|
prompt: string; |
||||
|
images?: string[]; |
||||
|
provider: LLMProvider; |
||||
|
model: LLMModelType; |
||||
|
temperature?: number; |
||||
|
maxTokens?: number; |
||||
|
} |
||||
|
|
||||
|
export interface LLMGenerateResponse { |
||||
|
success: boolean; |
||||
|
text?: string; |
||||
|
error?: string; |
||||
|
} |
||||
@ -1,53 +1,15 @@ |
|||||
// Re-export all types from domain files
|
/** |
||||
|
* Type Index |
||||
|
* |
||||
|
* Central re-export hub for all application types. |
||||
|
* Import from domain files for type definitions. |
||||
|
*/ |
||||
|
|
||||
|
// Domain re-exports
|
||||
export * from "./annotation"; |
export * from "./annotation"; |
||||
export * from "./nodes"; |
export * from "./nodes"; |
||||
export * from "./providers"; |
export * from "./providers"; |
||||
export * from "./models"; |
export * from "./models"; |
||||
export * from "./workflow"; |
export * from "./workflow"; |
||||
|
export * from "./api"; |
||||
// Import types for use in this file
|
export * from "./quickstart"; |
||||
import type { ProviderType, LLMProvider, LLMModelType } from "./providers"; |
|
||||
import type { AspectRatio, Resolution, ModelType } from "./models"; |
|
||||
|
|
||||
// Recently used models tracking
|
|
||||
export interface RecentModel { |
|
||||
provider: ProviderType; |
|
||||
modelId: string; |
|
||||
displayName: string; |
|
||||
timestamp: number; |
|
||||
} |
|
||||
|
|
||||
// API Request/Response types for Image Generation
|
|
||||
export interface GenerateRequest { |
|
||||
images: string[]; // Now supports multiple images
|
|
||||
prompt: string; |
|
||||
aspectRatio?: AspectRatio; |
|
||||
resolution?: Resolution; // Only for Nano Banana Pro
|
|
||||
model?: ModelType; |
|
||||
useGoogleSearch?: boolean; // Only for Nano Banana Pro
|
|
||||
} |
|
||||
|
|
||||
export interface GenerateResponse { |
|
||||
success: boolean; |
|
||||
image?: string; |
|
||||
video?: string; |
|
||||
videoUrl?: string; // For large videos, return URL directly
|
|
||||
contentType?: "image" | "video"; |
|
||||
error?: string; |
|
||||
} |
|
||||
|
|
||||
// API Request/Response types for LLM Text Generation
|
|
||||
export interface LLMGenerateRequest { |
|
||||
prompt: string; |
|
||||
images?: string[]; |
|
||||
provider: LLMProvider; |
|
||||
model: LLMModelType; |
|
||||
temperature?: number; |
|
||||
maxTokens?: number; |
|
||||
} |
|
||||
|
|
||||
export interface LLMGenerateResponse { |
|
||||
success: boolean; |
|
||||
text?: string; |
|
||||
error?: string; |
|
||||
} |
|
||||
|
|||||
Loading…
Reference in new issue