Commit Graph

5086 Commits

Author SHA1 Message Date
icarus
0c5a20a2e4 fix(translate): correct regex pattern for language code validation
fix(ocr): improve debug log by showing full provider details
2025-10-20 22:49:07 +08:00
icarus
917864be1c feat(utils): add safe json parsing utility
Add safeParseJson function to handle JSON parsing with error catching
2025-10-20 22:45:51 +08:00
icarus
e7e36d7df6 style(migrations): format json files with consistent indentation 2025-10-20 22:41:12 +08:00
icarus
0176cf7679 feat(ocr): add config validation and pass provider config to ocr handlers
Add type guards for OCR provider configs and ensure config is passed to OCR handlers
Update all built-in OCR services to validate config before processing
2025-10-20 22:40:12 +08:00
icarus
96f71f12ec fix(translate): show detailed error message when file processing fails 2025-10-20 22:21:00 +08:00
icarus
7942147ce0 feat(migrations): add initial sqlite migration for ocr_provider table
Add initial database migration files including schema definition for ocr_provider table and related metadata files. This sets up the foundation for OCR provider management in the system.
2025-10-20 22:15:55 +08:00
icarus
b7a6ed6b24 style: reorganize imports in ocr-related type files 2025-10-20 22:07:42 +08:00
icarus
790df761f0 refactor(types): move translate types to dedicated module
Centralize translate-related types and schemas in a dedicated module for better organization and maintainability. This change involves moving types from the shared index file to a new translate-specific file and updating import paths accordingly.
2025-10-20 21:58:34 +08:00
icarus
9215256d68 refactor(ocr): remove deprecated ocr slice actions and selectors
All functionality has been migrated elsewhere as indicated by the deprecation notice.
2025-10-20 21:52:49 +08:00
icarus
12b9b64ca8 refactor(ocr): move TimestampExtendShape to data.ts and clean up imports
Move TimestampExtendShape definition from api.ts to data.ts where it's primarily used
Clean up type imports and remove unnecessary comments
2025-10-20 21:02:26 +08:00
icarus
74e7979764 refactor(ocr): simplify response handling by removing wrapper objects
Remove unnecessary response wrapper objects ({ data: ... }) from OCR service methods and update types accordingly
Update API handlers to maintain consistent response structure
2025-10-20 20:58:08 +08:00
icarus
e0781e1bb0 refactor(ocr): restructure ocr types into modular files for better maintainability
- Split monolithic ocr.ts into separate files for base types, providers, models, and layers (api, data, business)
- Update related imports and references across the codebase
- Rename API request/response types to be more consistent (Patch->Update, Put->Replace)
- Adjust repository and service implementations to match new type structure
2025-10-20 20:39:24 +08:00
icarus
327d0dab7f refactor(ocr): remove ocr types to a single folder 2025-10-20 20:19:39 +08:00
icarus
75f513edb0 feat(i18n): add provider unavailable message for multiple locales
Add translation key for provider unavailable status in zh-cn locale and placeholders for other locales
2025-10-20 19:47:36 +08:00
icarus
52e2aff005 fix(ocr): add missing error message for unavailable provider
Add "not_availabel" translation key and use it when provider is unavailable. Also update type name from ImageOcrProvider to OcrProvider to better reflect its usage.
2025-10-20 19:46:57 +08:00
icarus
933d26e0f4 refactor(ocr): improve readability of updateProvider method signature
Split long method signature into multiple lines for better readability
2025-10-20 19:46:41 +08:00
icarus
4fd3300ed0 refactor(ocr): restructure ocr service and repository layers
- Extract database operations to new OcrProviderRepository
- Improve service initialization and provider management
- Add better error handling and logging
- Update API handlers to use new service methods
2025-10-20 19:35:39 +08:00
icarus
ad67d2558a refactor(ocr): update ocr settings components to use props instead of hooks
- Remove useOcrProvider hook usage in favor of direct props passing
- Add proper type casting for updateConfig functions
- Maintain consistent state management across all OCR provider settings
2025-10-20 09:15:41 +08:00
icarus
d47c3b1d63 refactor(ocr): restructure ocr provider settings and hooks
- Simplify useOcrImageProvider by directly using useOcrProvider
- Make useOcrProvider handle null provider IDs
- Update provider settings components to use passed props
- Remove styled-components in favor of tailwind classes
2025-10-20 09:10:04 +08:00
icarus
741bb94c8b refactor(hooks): rename provider to data for consistency with api response 2025-10-20 08:42:37 +08:00
icarus
46772b4f2a fix(ocr): include id in provider config update request
The id parameter was missing in the update request body, causing potential issues with identifying which provider to update. Add id to the request body to ensure correct provider is updated.
2025-10-20 08:39:46 +08:00
icarus
8aaf26e420 refactor(data): simplify ocr preferences mapping structure
Remove redundant ocr provider config mappings and consolidate to a single image provider id mapping
2025-10-20 08:33:59 +08:00
icarus
281632f859 feat(ocr): add validation for OCR provider operations
- Add params validation in API handlers to ensure path ID matches body ID
- Introduce isDbOcrProvider type guard for runtime validation
- Validate provider data before database operations
2025-10-20 08:28:15 +08:00
icarus
e4b5e70c34 refactor(ocr): update timestamp handling to use milliseconds
Use dayjs().valueOf() instead of dayjs().unix() to get timestamps in milliseconds for consistency with the updated schema comment
2025-10-20 08:21:18 +08:00
icarus
6f635472f3 refactor(ocr): improve provider schema and update handling
- Export DbOcrProviderSchema and add DbOcrProvider type
- Simplify provider update logic by merging entire object
- Add timestamps to create/update operations
- Maintain createdAt when updating existing providers
2025-10-20 08:18:54 +08:00
icarus
eb4927260a refactor(OcrImageSettings): remove logger and optimize setImageProvider
Replace direct logger usage with commented code and wrap setImageProvider in useCallback
2025-10-20 08:10:14 +08:00
icarus
a2e628d7e9 refactor(ocr): improve ocr provider handling and error states
- Add ListOcrProvidersQuery type for better type safety
- Update useOcrProviders hook to accept query params and handle undefined data
- Improve error handling and loading states in OcrImageSettings component
- Memoize filtered image providers for better performance
2025-10-20 08:07:32 +08:00
icarus
389dfc08f6 feat(ocr): add filtering by registration status to provider list
Add optional query parameter to filter OCR providers by registration status
Prevent modification and deletion of built-in OCR providers
2025-10-20 07:54:50 +08:00
icarus
7ea7e7134d refactor(ocr): add BuiltinOcrProviderIds constant for provider ids
Use objectValues utility to create a frozen array of provider ids for better maintainability and type safety
2025-10-20 07:47:11 +08:00
icarus
1423163b3a refactor(ocr): rename BuiltinOcrProviderIds to BuiltinOcrProviderIdMap for consistency 2025-10-20 07:45:53 +08:00
icarus
f9ed8343fe feat(ocr): implement delete provider API endpoint
Add DELETE endpoint for OCR providers with proper type definitions and handler implementation. The endpoint removes the provider from both the registry and database after validation checks.
2025-10-20 07:40:31 +08:00
icarus
a042892250 feat(ocr): implement create and update provider endpoints
add POST handler for creating new OCR providers
add PUT handler for updating existing OCR providers
add required request/response types and schemas
2025-10-20 07:35:03 +08:00
icarus
b67b4c8178 feat(ocr): update provider config by merging with existing values
Use lodash merge to combine existing provider config with updates instead of overwriting
2025-10-20 07:27:09 +08:00
icarus
4ab6961fcc feat(ocr): add type for OcrProviderId and getProvider method
Add OcrProviderId type definition and implement getProvider method in OcrService to fetch a single OCR provider by ID
2025-10-20 07:23:41 +08:00
icarus
4e7a67df59 feat(ocr): implement PATCH endpoint for OCR provider updates
Add PATCH handler for OCR provider updates with request/response schemas
Implement patchProvider method in OcrService to update provider data
2025-10-20 07:19:08 +08:00
icarus
1e9014b080 feat(ocr): implement ocr providers list endpoint
Add DbOcrProviderSchema and update response schemas for list and get endpoints
Implement the GET /ocr/providers endpoint using ocrService
2025-10-20 07:00:23 +08:00
icarus
8ac9344fef feat(i18n): add provider error messages and search translations
Add error messages for provider operations (create, delete, get, list, update) in multiple languages
Include search-related translations for various languages
Add new OVMS runtime error codes for installation process
2025-10-20 06:54:48 +08:00
icarus
3250d982fc docs(ocr): add todo comment for builtin providers registration 2025-10-20 06:48:49 +08:00
icarus
4dcfe276ac refactor(ocr): change provider listing to include db data
Replace simple registry key listing with combined db query to filter available providers
2025-10-20 06:47:44 +08:00
icarus
78126c3d0b refactor(ocr): simplify useOcrProvider hook by using data api
Replace complex provider and config management with useQuery and useMutation hooks
Add loading states and error handling
Remove unused imports and simplify return type
2025-10-20 06:47:22 +08:00
icarus
37ad896f6a refactor(ocr): restructure OCR provider configuration and types
- Remove separate configs from store and move them into provider definitions
- Add Zod schemas for OCR provider types and configurations
- Update migration to use new provider structure
- Make OCR provider config non-nullable in database schema
- Clean up unused OCR preference settings
2025-10-20 06:47:02 +08:00
icarus
84a513a6ae refactor(ocr): move provider registration to constructor
Initialize built-in OCR providers during service instantiation instead of after creation for better encapsulation and initialization control
2025-10-20 05:18:51 +08:00
icarus
f538e89976 Revert "refactor(ocr): simplify ocr providers api by returning string array"
This reverts commit 695afb6f75.
2025-10-20 05:16:35 +08:00
icarus
f10f0b21f9 Revert "refactor(db): remove unused ocr provider schema table"
This reverts commit 9c740f82ad.
2025-10-20 05:08:24 +08:00
icarus
49c80620ae refactor(ocr): simplify ocr service interface and params handling
- Replace OcrProvider with OcrParams to simplify interface
- Remove unused OcrApiClientFactory and related code
- Consolidate ocr service calls to use consistent params structure
2025-10-20 05:07:53 +08:00
Phantom
68aaf9df4a fix: use consistent sharp dependencies (#10832)
build: update sharp dependencies to version 0.34.3

Update sharp image processing library dependencies to latest version 0.34.3 across all platforms (darwin, linux, win32) to ensure consistent behavior and security fixes
2025-10-20 04:33:17 +08:00
icarus
b31b48fcaf refactor(ocr): remove unused OCR list providers functionality 2025-10-20 04:31:02 +08:00
icarus
82b244471b refactor(OcrImageSettings): simplify provider selection logic and improve UI
Remove unused imports and simplify the provider filtering logic by removing platform-specific checks
Update UI styling to use Tailwind classes instead of inline styles
2025-10-20 03:36:04 +08:00
icarus
062cbcc259 feat(ui): add skeleton component to shadcn-io exports
Export new Skeleton component from shadcn-io directory and add comment about potential future organization
2025-10-20 03:35:21 +08:00
icarus
b50d8b2a23 refactor(ocr): remove unused error message and simplify provider check
Move provider availability check outside of useCallback and remove unused error message from translations
2025-10-20 03:19:38 +08:00