Commit Graph

5066 Commits

Author SHA1 Message Date
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
icarus
b262410518 refactor(ocr): use config from useOcrProvider hook directly
Update OCR settings components to use config object returned by useOcrProvider hook instead of accessing it through provider.config. This provides more direct access to the configuration data and improves consistency across components.
2025-10-20 03:13:25 +08:00
icarus
a34426d431 refactor(ocr): improve type safety and config handling in useOcrProvider
- Replace dynamic provider lookup with type-safe registry pattern
- Add separate config management for each provider type
- Remove unused imports and simplify provider fallback logic
2025-10-20 03:06:11 +08:00
icarus
94ed39ab27 refactor(ocr): simplify provider fallback logic and remove unused methods
Remove unused provider management methods (add/remove) and simplify the fallback logic in useOcrProvider to always use Tesseract when provider is not found
2025-10-20 02:30:57 +08:00
icarus
ed8501961a refactor(ocr): extract image provider logic to separate hook
Move image provider related state and logic from useOcrProviders to new useOcrImageProvider hook
Update all components to use the new hook for better separation of concerns
2025-10-20 02:27:10 +08:00
icarus
78000816e5 refactor(useOcrProvider): rename useOcrProvider from tsx to ts 2025-10-20 02:21:29 +08:00
icarus
5900ff0c6e feat(ocr): add provider availability check and error message
Add validation to ensure OCR provider can process images before attempting OCR
2025-10-20 02:17:28 +08:00
icarus
b310ea1407 feat(ocr): add type guard for OcrProvider
Add isOcrProvider type guard function to validate unknown inputs against OcrProviderSchema
2025-10-20 02:11:29 +08:00
icarus
beb44eea61 refactor(ocr): move provider logo logic to component and consolidate hooks
Move OcrProviderLogo implementation from useOcrProviders hook to the component file
Extract common OCR provider logic into a separate useOcrProviders hook
Clean up and reorganize related imports and exports
2025-10-20 02:07:12 +08:00
icarus
7658b1e79f refactor(ocr): reorganize ocr hooks into dedicated directory
Move useOcr and useOcrProvider hooks to new ocr directory under hooks
Update all imports in settings components to reflect new paths
2025-10-20 02:01:56 +08:00
icarus
ea1aa6e5a8 refactor(ocr): remove unused langs config from ovocr provider
The langs configuration for ovocr provider is not currently configurable, so it's removed from both type definition and default config.
2025-10-20 01:58:03 +08:00
icarus
e823d97e31 feat(ocr): add provider config mappings and default preferences
Add OCR provider configuration mappings to PreferencesMappings.ts and define default preferences for OCR providers in preferenceSchemas.ts. This enables support for multiple OCR providers with their respective configurations.
2025-10-20 01:54:22 +08:00
icarus
515d3cd596 refactor(data): update PreferencesMappings type with PreferenceSchemas
Add type import for PreferenceSchemas and update REDUX_STORE_MAPPINGS type to use keyof PreferenceSchemas
Mark several mappings with TODO comments for future fixes
2025-10-20 01:53:49 +08:00
icarus
47366064ca refactor(ocr): move ocr config to shared and add utility function
Migrate ocr configuration from renderer to shared config and introduce getDefaultOcrProvider utility function to centralize default provider logic
2025-10-20 01:44:23 +08:00
icarus
61a71a0486 refactor(utils): reorganize utils files into module structure
Move defaultAppHeaders function from utils.ts to new net.ts module and create index.ts for exports
2025-10-20 01:40:01 +08:00
icarus
e640beb874 refactor(ocr): move ocr config to shared package for reuse
Centralize OCR configuration in shared package to avoid duplication and improve maintainability. This change affects multiple components that previously imported from renderer config.
2025-10-20 01:37:00 +08:00
icarus
9386a4d482 refactor(ocr): restructure ocr provider config handling
move provider configs from individual providers to a centralized config map
add migration for new ocr config structure
2025-10-20 01:26:37 +08:00
icarus
90e02e64b7 refactor(types): mark OcrProvider.config as deprecated
The config property is being phased out in favor of a more streamlined type structure. This change marks it as deprecated while maintaining backward compatibility.
2025-10-20 01:09:30 +08:00
icarus
08d8f70752 refactor(data): add type constraint to REDUX_STORE_MAPPINGS 2025-10-20 01:06:11 +08:00
icarus
695afb6f75 refactor(ocr): simplify ocr providers api by returning string array
Remove unused OcrProvider type and related endpoints. The GET endpoint now returns a simple array of provider IDs instead of full provider objects, as the detailed provider data will be handled separately.
2025-10-20 01:02:17 +08:00
icarus
471b1fae2d docs(IBaseService): add type parameter documentation to interface 2025-10-20 00:59:44 +08:00