mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 06:19:05 +08:00
parent
8cfe6a5848
commit
e5d94d9a53
@ -111,7 +111,6 @@ export default class MineruPreprocessProvider extends BasePreprocessProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async validateFile(filePath: string): Promise<void> {
|
private async validateFile(filePath: string): Promise<void> {
|
||||||
const quota = await this.checkQuota()
|
|
||||||
const pdfBuffer = await fs.promises.readFile(filePath)
|
const pdfBuffer = await fs.promises.readFile(filePath)
|
||||||
|
|
||||||
const doc = await this.readPdf(new Uint8Array(pdfBuffer))
|
const doc = await this.readPdf(new Uint8Array(pdfBuffer))
|
||||||
@ -125,10 +124,6 @@ export default class MineruPreprocessProvider extends BasePreprocessProvider {
|
|||||||
const fileSizeMB = Math.round(pdfBuffer.length / (1024 * 1024))
|
const fileSizeMB = Math.round(pdfBuffer.length / (1024 * 1024))
|
||||||
throw new Error(`PDF file size (${fileSizeMB}MB) exceeds the limit of 200MB`)
|
throw new Error(`PDF file size (${fileSizeMB}MB) exceeds the limit of 200MB`)
|
||||||
}
|
}
|
||||||
// 检查配额
|
|
||||||
if (quota <= 0 || quota - doc.numPages <= 0) {
|
|
||||||
throw new Error('MinerU解析配额不足,请申请企业账户或自行部署,剩余额度:' + quota)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private createProcessedFileInfo(file: FileMetadata, outputPath: string): FileMetadata {
|
private createProcessedFileInfo(file: FileMetadata, outputPath: string): FileMetadata {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user