This commit is contained in:
babayaga 2026-01-21 08:47:23 +01:00
parent 3f4f189870
commit 6a8c3d1edc
2 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,7 @@
# ImageWizard Component Structure
## Overview
The ImageWizard is split into focused modules for better maintainability.
## File Structure
@ -29,21 +30,25 @@ ImageWizard/
## Recent Refactorings
### 1. ✅ Prompt Splitter Extracted (`promptHandlers.ts`)
- `generateImageSplit` - Sequential multi-prompt generation
- Uses `splitPromptByLines` from `@constants.ts`
### 2. ✅ Logger Refactored (`utils/logger.ts`)
- Changed from `addLog('debug', ...)` to `logger.debug(...)`
- Created `Logger` interface with clean methods: `debug()`, `info()`, `warning()`, `error()`, `success()`, `verbose()`
- All handlers now accept `Logger` instead of raw `addLog` function
- Component name auto-prefixed in logs
### 3. ✅ DEFAULT_QUICK_ACTIONS Moved to `@constants.ts`
- `QuickAction` interface now exported from constants
- Available throughout the codebase
- Removed duplicate from `types.ts`
### 4. ✅ Drag and Drop Extracted (`dropHandlers.ts`)
- `handleDragEnter` - Show drop overlay
- `handleDragOver` - Keep overlay active
- `handleDragLeave` - Debounced hide (prevents flicker)
@ -52,6 +57,7 @@ ImageWizard/
## Handler Categories
### 📸 imageHandlers.ts
- `handleFileUpload` - Upload files
- `toggleImageSelection` - Select/deselect images
- `removeImageRequest` - Request image deletion
@ -60,32 +66,40 @@ ImageWizard/
- `handleDownloadImage` - Download image
### 🎨 generationHandlers.ts
- `handleOptimizePrompt` - Optimize prompt with AI
- `buildFullPrompt` - Build prompt with preset context
- `abortGeneration` - Cancel generation
### 📝 promptHandlers.ts
- `generateImageSplit` - Sequential multi-prompt generation
### 🎤 voiceHandlers.ts
- `handleMicrophone` - Record audio
- `handleVoiceToImage` - Voice-to-image workflow with AI
### 🤖 agentHandlers.ts
- `handleAgentGeneration` - AI Agent mode with tool calling
### 📤 publishHandlers.ts
- `publishImage` - Standard publish
- `quickPublishAsNew` - Quick publish with prompt as description
### 💾 dataHandlers.ts
- `loadFamilyVersions` - Load image version families
- `loadAvailableImages` - Load gallery images
### ⚙️ settingsHandlers.ts
- Template, preset, workflow, history management
### 🎯 dropHandlers.ts
- Drag and drop file handling
## Usage Example
@ -105,6 +119,7 @@ logger.info('File uploaded successfully');
```
## Benefits
✅ Easier to find specific logic
✅ Better code organization
✅ Simpler testing
@ -112,4 +127,3 @@ logger.info('File uploaded successfully');
✅ Clear separation of concerns
✅ Clean logging API
✅ Reusable utilities

View File

@ -2,8 +2,7 @@ import React, { useEffect } from 'react';
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { VideoModelInfo, AVAILABLE_VIDEO_MODELS, VideoGenerationOptions } from "@/lib/video-router";
import { AVAILABLE_VIDEO_MODELS, VideoGenerationOptions } from "@/lib/video-router";
interface VideoSettingsControlsProps {
modelName: string;