fix: resolve 7 frontend-backend API inconsistencies and add comprehensive documentation
- Fixed LoginResponse: added expires_in field - Renamed format to file_format across FileInfo interface - Updated ProcessRequest: replaced confidence_threshold with detect_layout - Modified ProcessResponse: added message and total_files, removed task_id - Removed non-existent getTaskStatus API call - Fixed getOCRResult parameter from taskId to fileId - Commented out translation config APIs pending backend implementation Documentation: - Added API_REFERENCE.md: Complete API endpoint inventory - Added API_FIX_SUMMARY.md: Detailed before/after comparison of all fixes - Added FRONTEND_API.md: Frontend integration documentation - Added FRONTEND_QUICK_START.md: Quick start guide - Added FRONTEND_UPGRADE_SUMMARY.md: Upgrade summary 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,6 @@ import type {
|
||||
UploadResponse,
|
||||
ProcessRequest,
|
||||
ProcessResponse,
|
||||
TaskStatus,
|
||||
BatchStatus,
|
||||
OCRResult,
|
||||
ExportRequest,
|
||||
@@ -151,18 +150,11 @@ class ApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get task status
|
||||
* Get OCR result by file ID
|
||||
* Note: Backend uses file-level tracking, not task-level
|
||||
*/
|
||||
async getTaskStatus(taskId: string): Promise<TaskStatus> {
|
||||
const response = await this.client.get<TaskStatus>(`/ocr/status/${taskId}`)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OCR result
|
||||
*/
|
||||
async getOCRResult(taskId: string): Promise<OCRResult> {
|
||||
const response = await this.client.get<OCRResult>(`/ocr/result/${taskId}`)
|
||||
async getOCRResult(fileId: number): Promise<OCRResult> {
|
||||
const response = await this.client.get<OCRResult>(`/ocr/result/${fileId}`)
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -251,28 +243,26 @@ class ApiClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get translation configs (STUB - Not yet implemented)
|
||||
* This is a placeholder for future translation functionality
|
||||
* @throws Will throw error with status 501 (Not Implemented)
|
||||
* Get translation configs (NOT IMPLEMENTED)
|
||||
* This endpoint does not exist on backend - configs will be part of Phase 5
|
||||
* @deprecated Backend endpoint does not exist - will return 404
|
||||
*/
|
||||
async getTranslationConfigs(): Promise<TranslationConfig[]> {
|
||||
// This endpoint is expected to return 501 Not Implemented until Phase 5
|
||||
const response = await this.client.get<TranslationConfig[]>('/translate/configs')
|
||||
return response.data
|
||||
}
|
||||
// async getTranslationConfigs(): Promise<TranslationConfig[]> {
|
||||
// const response = await this.client.get<TranslationConfig[]>('/translate/configs')
|
||||
// return response.data
|
||||
// }
|
||||
|
||||
/**
|
||||
* Create translation config (STUB - Not yet implemented)
|
||||
* This is a placeholder for future translation functionality
|
||||
* @throws Will throw error with status 501 (Not Implemented)
|
||||
* Create translation config (NOT IMPLEMENTED)
|
||||
* This endpoint does not exist on backend - configs will be part of Phase 5
|
||||
* @deprecated Backend endpoint does not exist - will return 404
|
||||
*/
|
||||
async createTranslationConfig(
|
||||
config: Omit<TranslationConfig, 'id' | 'created_at'>
|
||||
): Promise<TranslationConfig> {
|
||||
// This endpoint is expected to return 501 Not Implemented until Phase 5
|
||||
const response = await this.client.post<TranslationConfig>('/translate/configs', config)
|
||||
return response.data
|
||||
}
|
||||
// async createTranslationConfig(
|
||||
// config: Omit<TranslationConfig, 'id' | 'created_at'>
|
||||
// ): Promise<TranslationConfig> {
|
||||
// const response = await this.client.post<TranslationConfig>('/translate/configs', config)
|
||||
// return response.data
|
||||
// }
|
||||
}
|
||||
|
||||
// Export singleton instance
|
||||
|
||||
Reference in New Issue
Block a user