Browse Source

feat(19-02): extract API types and finalize index.ts

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
shrimbly 6 months ago
parent
commit
1dd24e7f63
  1. 44
      src/types/api.ts
  2. 58
      src/types/index.ts
  3. 8
      src/types/providers.ts

44
src/types/api.ts

@ -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;
}

58
src/types/index.ts

@ -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;
}

8
src/types/providers.ts

@ -37,3 +37,11 @@ export type LLMModelType =
| "gemini-3-pro-preview" | "gemini-3-pro-preview"
| "gpt-4.1-mini" | "gpt-4.1-mini"
| "gpt-4.1-nano"; | "gpt-4.1-nano";
// Recently used models tracking
export interface RecentModel {
provider: ProviderType;
modelId: string;
displayName: string;
timestamp: number;
}

Loading…
Cancel
Save