diff --git a/docker-compose.yml b/docker-compose.yml index 4ef782c5..a6430da3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -217,6 +217,8 @@ services: container_name: mineru profiles: - all + env_file: + - .env ports: - 30000:30000 environment: @@ -253,6 +255,8 @@ services: container_name: mineru-api profiles: - all + env_file: + - .env ports: - 30001:30001 environment: diff --git a/docs/advanced/document-processing.md b/docs/advanced/document-processing.md index 1a0601c6..21463e78 100644 --- a/docs/advanced/document-processing.md +++ b/docs/advanced/document-processing.md @@ -21,6 +21,15 @@ docker compose up -d api ### 2. 高精度 OCR (MinerU) +需要配置: + +```bash +MINERU_VL_SERVER=http://localhost:30000 +MINERU_API_URI=http://localhost:30001 +``` + +然后启动相关服务 + ```bash # 需要 GPU,启动 MinerU 服务 docker compose up -d mineru-vllm-server mineru-api diff --git a/web/src/components/FileUploadModal.vue b/web/src/components/FileUploadModal.vue index e2fee78f..0df7efa2 100644 --- a/web/src/components/FileUploadModal.vue +++ b/web/src/components/FileUploadModal.vue @@ -97,6 +97,11 @@ + +
+ ⚠️ 检测到PDF或图片文件,请启用OCR功能以提取文本内容 +
+
{ return type === 'lightrag'; }); +// 计算属性:是否启用了OCR +const isOcrEnabled = computed(() => { + return chunkParams.value.enable_ocr !== 'disable'; +}); + +// 计算属性:是否有PDF或图片文件 +const hasPdfOrImageFiles = computed(() => { + if (fileList.value.length === 0) { + return false; + } + + const pdfExtensions = ['.pdf']; + const imageExtensions = ['.jpg', '.jpeg', '.png', '.bmp', '.tiff', '.tif', '.gif', '.webp']; + const ocrExtensions = [...pdfExtensions, ...imageExtensions]; + + return fileList.value.some(file => { + if (file.status !== 'done') { + return false; + } + + const filePath = file.response?.file_path || file.name; + if (!filePath) { + return false; + } + + const ext = filePath.substring(filePath.lastIndexOf('.')).toLowerCase(); + return ocrExtensions.includes(ext); + }); +}); + // 计算属性:OCR选项 const enableOcrOptions = computed(() => [ { @@ -677,4 +713,15 @@ const chunkData = async () => { .chunk-config-content .params-info { margin-bottom: 16px; } + +// OCR警告提醒样式 +.ocr-warning-alert { + margin: 12px 0; + padding: 8px 12px; + background: #fff7e6; + border: 1px solid #ffd666; + border-radius: 4px; + color: #d46b08; + font-size: 13px; +}