* feat(pdf): add MinerU Cloud API as PDF parsing provider Add MinerU Cloud (v4 API) as a new PDF provider alongside unpdf (built-in) and MinerU (self-hosted). Users can now parse PDFs via the cloud API without deploying a self-hosted MinerU instance. - New provider `mineru-cloud` with API key auth and optional base URL - Cloud flow: batch create → presigned upload → poll → ZIP download → parse - Extract shared `mineru-parser.ts` from inline code (used by both paths) - Settings UI adapted for cloud (API key required) vs self-hosted (base URL required) - Server-side env var support: PDF_MINERU_CLOUD_API_KEY / PDF_MINERU_CLOUD_BASE_URL - SSRF protection on cloud verification endpoint - i18n translations for en-US, zh-CN, ja-JP, ru-RU Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(provider-config): revert PDF activation to requiresBaseUrl Reverts the PDF section from keylessProviders back to requiresBaseUrl: true to fix failing test: mineru with only apiKey (no baseUrl) should not activate. mineru-cloud API key can be configured via browser settings UI instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(pdf-settings): enable test button when API key is server-configured The test connection button was disabled when the API key was only configured server-side (not entered by user in browser). Now checks isServerConfigured in addition to user-entered values. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
650 B
TypeScript
32 lines
650 B
TypeScript
/**
|
|
* PDF Parsing Provider Type Definitions
|
|
*/
|
|
|
|
/**
|
|
* PDF Provider IDs
|
|
*/
|
|
export type PDFProviderId = 'unpdf' | 'mineru' | 'mineru-cloud';
|
|
|
|
/**
|
|
* PDF Provider Configuration
|
|
*/
|
|
export interface PDFProviderConfig {
|
|
id: PDFProviderId;
|
|
name: string;
|
|
requiresApiKey: boolean;
|
|
baseUrl?: string;
|
|
icon?: string;
|
|
features: string[]; // ['text', 'images', 'tables', 'formulas', 'layout-analysis', etc.]
|
|
}
|
|
|
|
/**
|
|
* PDF Parser Configuration for API calls
|
|
*/
|
|
export interface PDFParserConfig {
|
|
providerId: PDFProviderId;
|
|
apiKey?: string;
|
|
baseUrl?: string;
|
|
}
|
|
|
|
// Note: ParsedPdfContent is imported from @/lib/types/pdf to avoid duplication
|