import { BaseAIUseCase } from '../../middleware/usecases/base/base-ai.usecase'; import { BaseAIRequest, BaseAIResult } from '../../middleware/shared/types/base-request.types'; import { ModelParameterOverrides } from '../../middleware/services/model-parameter-manager/model-parameter-manager.service'; /** * Story generation context interface */ export interface StoryContext { setting?: string; protagonist?: string; antagonist?: string; theme?: string; tone?: string; wordCount?: string; genre?: string; constraints?: string[]; [key: string]: any; } /** * Story generation prompt - supports both simple strings and complex objects */ export type StoryPrompt = string | { context?: StoryContext; instruction: string; } | { prompt: { context?: StoryContext; instruction: string; }; }; /** * Story generation request interface */ export interface StoryGeneratorRequest extends BaseAIRequest { } /** * Story generation result interface */ export interface StoryGeneratorResult extends BaseAIResult { story: string; wordCount: number; extractedContext: StoryContext | null; extractedInstruction: string; } /** * Story Generator Use Case * * Demonstrates RequestFormatterService with complex nested context objects. * * **Key Features:** * - Supports simple string prompts: "Write a story about dragons" * - Supports complex objects with context and instruction * - Uses RequestFormatterService for flexible prompt handling * - Formats context using FlatFormatter (via RequestFormatterService) * - Creative Writing preset for varied, engaging prose * * **Example Requests:** * * Simple string: * ``` * { prompt: "Write a story about a lost key" } * ``` * * Complex with context: * ``` * { * prompt: { * context: { * setting: "abandoned lighthouse, stormy night", * protagonist: "elderly lighthouse keeper", * theme: "redemption and forgiveness", * tone: "melancholic yet hopeful", * wordCount: "500-700 words", * genre: "literary fiction" * }, * instruction: "Write the opening scene where the keeper discovers an unexpected visitor." * } * } * ``` * * This use case shows how RequestFormatterService: * - Extracts context and instruction from various formats * - Formats nested objects into structured CONTEXT/INSTRUCTION sections * - Uses FlatFormatter for clean context presentation * - Validates prompts before processing */ export declare class StoryGeneratorUseCase extends BaseAIUseCase { protected readonly systemMessage = "You are a creative writing assistant specializing in short story generation.\n\nYour task is to generate engaging, well-structured short stories based on the provided context and instructions.\n\nWRITING GUIDELINES:\n- Create vivid, immersive scenes with sensory details\n- Develop characters with clear motivations and conflicts\n- Use active voice and varied sentence structure\n- Maintain consistent tone and style throughout\n- Include dialogue where appropriate\n- Build tension and resolution\n\nSTRUCTURE:\n- Opening: Hook the reader immediately\n- Development: Build character and conflict\n- Climax: Reach the story's turning point\n- Resolution: Provide satisfying closure\n\nQUALITY STANDARDS:\n- Original, creative content\n- Grammatically correct prose\n- Appropriate pacing for word count\n- Clear narrative arc\n\nGenerate the complete story as plain text (no JSON, no code blocks)."; /** * Get the user template from message file */ protected getUserTemplate(): (formattedPrompt: string) => string; /** * Format the user message using RequestFormatterService * * This demonstrates the primary use case for RequestFormatterService: * handling complex, nested prompt structures with context and instructions. */ protected formatUserMessage(prompt: StoryPrompt): string; /** * Override model parameters for creative story generation * * Uses Creative Writing preset for engaging, varied prose. */ protected getParameterOverrides(): ModelParameterOverrides; /** * Create the result with extracted metadata */ protected createResult(content: string, usedPrompt: string, thinking?: string): StoryGeneratorResult; private currentRequest?; /** * Override execute to store request for result creation */ execute(request: StoryGeneratorRequest): Promise; } //# sourceMappingURL=story-generator.usecase.d.ts.map