feat: add real-time preprocessing preview with side-by-side comparison
- Create PreprocessingPreview component with debounced config updates - Show original vs preprocessed images side-by-side - Display image quality metrics (contrast, sharpness) with quality indicators - Add zoom controls and fullscreen view for detailed inspection - Show auto-detected configuration when in auto mode - Integrate preview toggle with PreprocessingSettings component - Add i18n translations for preview panel UI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,8 @@ import type {
|
||||
ProcessingOptions,
|
||||
ProcessingMetadata,
|
||||
DocumentAnalysisResponse,
|
||||
PreprocessingPreviewRequest,
|
||||
PreprocessingPreviewResponse,
|
||||
} from '@/types/apiV2'
|
||||
|
||||
/**
|
||||
@@ -517,6 +519,41 @@ class ApiClientV2 {
|
||||
window.URL.revokeObjectURL(link.href)
|
||||
}
|
||||
|
||||
// ==================== Preprocessing Preview APIs ====================
|
||||
|
||||
/**
|
||||
* Preview preprocessing effect on a page
|
||||
*/
|
||||
async previewPreprocessing(
|
||||
taskId: string,
|
||||
request: PreprocessingPreviewRequest
|
||||
): Promise<PreprocessingPreviewResponse> {
|
||||
const response = await this.client.post<PreprocessingPreviewResponse>(
|
||||
`/tasks/${taskId}/preview/preprocessing`,
|
||||
request
|
||||
)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/**
|
||||
* Get preprocessing preview image URL (with auth token)
|
||||
*/
|
||||
getPreviewImageUrl(taskId: string, type: 'original' | 'preprocessed', page: number): string {
|
||||
const baseUrl = `${API_BASE_URL}/api/${API_VERSION}/tasks/${taskId}/preview/image`
|
||||
return `${baseUrl}?type=${type}&page=${page}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Get preview image as blob (with authentication)
|
||||
*/
|
||||
async getPreviewImage(taskId: string, type: 'original' | 'preprocessed', page: number): Promise<Blob> {
|
||||
const response = await this.client.get(`/tasks/${taskId}/preview/image`, {
|
||||
params: { type, page },
|
||||
responseType: 'blob',
|
||||
})
|
||||
return response.data
|
||||
}
|
||||
|
||||
// ==================== Admin APIs ====================
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user