mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 18:50:56 +08:00
refactor(ocr): 添加日志记录以跟踪OCR文件处理
在OCR服务中添加日志记录功能,便于跟踪文件处理过程
This commit is contained in:
parent
31cf452974
commit
4e30d89e1c
@ -1,8 +1,9 @@
|
||||
import { loggerService } from '@logger'
|
||||
import { isOcrApiProvider, OcrProvider, OcrResult, SupportedOcrFile } from '@renderer/types'
|
||||
|
||||
import { OcrApiClientFactory } from './clients/OcrApiClientFactory'
|
||||
|
||||
// const logger = loggerService.withContext('renderer:OcrService')
|
||||
const logger = loggerService.withContext('renderer:OcrService')
|
||||
|
||||
/**
|
||||
* ocr a file
|
||||
@ -12,6 +13,7 @@ import { OcrApiClientFactory } from './clients/OcrApiClientFactory'
|
||||
* @throws {Error}
|
||||
*/
|
||||
export const ocr = async (file: SupportedOcrFile, provider: OcrProvider): Promise<OcrResult> => {
|
||||
logger.info(`ocr file ${file.path}`)
|
||||
if (isOcrApiProvider(provider)) {
|
||||
const client = OcrApiClientFactory.create(provider)
|
||||
return client.ocr(file)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user