fix: 默认OCR引擎换成MinerU而不是mistral
This commit is contained in:
parent
5c1c66bd8f
commit
b019917c18
|
|
@ -1758,10 +1758,10 @@ async function handleProcessClick() {
|
|||
|
||||
// 2. 检查 OCR 配置(如果有 PDF 文件)
|
||||
if (hasPdfFiles) {
|
||||
let ocrEngine = 'mistral';
|
||||
let ocrEngine = 'mineru';
|
||||
try {
|
||||
if (window.ocrSettingsManager && typeof window.ocrSettingsManager.getCurrentConfig === 'function') {
|
||||
ocrEngine = window.ocrSettingsManager.getCurrentConfig().engine || 'mistral';
|
||||
ocrEngine = window.ocrSettingsManager.getCurrentConfig().engine || 'mineru';
|
||||
const validation = window.ocrSettingsManager.validateConfig();
|
||||
if (!validation.valid) {
|
||||
const engineNames = { mistral: 'Mistral OCR', mineru: 'MinerU', doc2x: 'Doc2X', none: '不需要 OCR' };
|
||||
|
|
|
|||
|
|
@ -137,13 +137,13 @@ const fileType = fileToProcess.name.split('.').pop().toLowerCase();
|
|||
let usedOcrEngine = null;
|
||||
let usedOcrSource = null;
|
||||
// 更合理的开始日志:显示 OCR 引擎而不是固定显示 Mistral Key
|
||||
let ocrEngineForLog = 'mistral';
|
||||
let ocrEngineForLog = 'mineru';
|
||||
try {
|
||||
if (typeof window !== 'undefined' && window.ocrSettingsManager && typeof window.ocrSettingsManager.getCurrentConfig === 'function') {
|
||||
const cfg = window.ocrSettingsManager.getCurrentConfig();
|
||||
if (cfg && cfg.engine) ocrEngineForLog = cfg.engine;
|
||||
} else {
|
||||
ocrEngineForLog = localStorage.getItem('ocrEngine') || 'mistral';
|
||||
ocrEngineForLog = localStorage.getItem('ocrEngine') || 'mineru';
|
||||
}
|
||||
} catch {}
|
||||
if (typeof addProgressLog === "function") {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class OcrManager {
|
|||
}
|
||||
|
||||
// Fallback: 直接从 localStorage 读取
|
||||
const engine = localStorage.getItem('ocrEngine') || 'mistral';
|
||||
const engine = localStorage.getItem('ocrEngine') || 'mineru';
|
||||
|
||||
switch (engine) {
|
||||
case 'local':
|
||||
|
|
|
|||
|
|
@ -711,7 +711,7 @@ KeyManagerUI.exportAllModelData = function() {
|
|||
|
||||
// 添加 OCR 配置导出
|
||||
const ocrConfig = {
|
||||
engine: localStorage.getItem('ocrEngine') || 'mistral',
|
||||
engine: localStorage.getItem('ocrEngine') || 'mineru', // 默认为 mineru
|
||||
mistralKeys: localStorage.getItem('ocrMistralKeys') || '',
|
||||
workerAuthKey: localStorage.getItem('ocrWorkerAuthKey') || '',
|
||||
mineruToken: localStorage.getItem('ocrMinerUToken') || '',
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class OcrSettingsManager {
|
|||
loadSettings() {
|
||||
try {
|
||||
// 引擎选择
|
||||
const engine = localStorage.getItem(this.keys.engine) || 'mistral';
|
||||
const engine = localStorage.getItem(this.keys.engine) || 'mineru';
|
||||
if (this.elements.ocrEngine) {
|
||||
this.elements.ocrEngine.value = engine;
|
||||
this.switchEngine(engine); // 显示对应的配置面板
|
||||
|
|
@ -476,7 +476,7 @@ class OcrSettingsManager {
|
|||
* @returns {Object} 配置对象
|
||||
*/
|
||||
getCurrentConfig() {
|
||||
const engine = localStorage.getItem(this.keys.engine) || 'mistral';
|
||||
const engine = localStorage.getItem(this.keys.engine) || 'mineru';
|
||||
|
||||
switch (engine) {
|
||||
case 'none':
|
||||
|
|
|
|||
|
|
@ -131,18 +131,18 @@
|
|||
const hasPdfFiles = effectiveFiles.some(file => file.name.toLowerCase().endsWith('.pdf'));
|
||||
|
||||
// 检查 OCR 引擎与所需配置
|
||||
let ocrEngine = 'mistral';
|
||||
let ocrEngine = 'mineru';
|
||||
let ocrConfigValid = true;
|
||||
let ocrConfigMessage = '';
|
||||
try {
|
||||
if (window.ocrSettingsManager && typeof window.ocrSettingsManager.getCurrentConfig === 'function') {
|
||||
ocrEngine = window.ocrSettingsManager.getCurrentConfig().engine || (localStorage.getItem('ocrEngine') || 'mistral');
|
||||
ocrEngine = window.ocrSettingsManager.getCurrentConfig().engine || (localStorage.getItem('ocrEngine') || 'mineru');
|
||||
// 使用 validateConfig 检查配置是否完整
|
||||
const validation = window.ocrSettingsManager.validateConfig();
|
||||
ocrConfigValid = validation.valid;
|
||||
ocrConfigMessage = validation.message;
|
||||
} else {
|
||||
ocrEngine = localStorage.getItem('ocrEngine') || 'mistral';
|
||||
ocrEngine = localStorage.getItem('ocrEngine') || 'mineru';
|
||||
}
|
||||
} catch {}
|
||||
|
||||
|
|
|
|||
|
|
@ -186,13 +186,13 @@
|
|||
});
|
||||
|
||||
// 检查当前 OCR 引擎配置
|
||||
let currentOcrEngine = 'mistral';
|
||||
let currentOcrEngine = 'mineru';
|
||||
let currentOcrConfigured = false;
|
||||
try {
|
||||
if (window.ocrSettingsManager && typeof window.ocrSettingsManager.getCurrentConfig === 'function') {
|
||||
currentOcrEngine = window.ocrSettingsManager.getCurrentConfig().engine || (localStorage.getItem('ocrEngine') || 'mistral');
|
||||
currentOcrEngine = window.ocrSettingsManager.getCurrentConfig().engine || (localStorage.getItem('ocrEngine') || 'mineru');
|
||||
} else {
|
||||
currentOcrEngine = localStorage.getItem('ocrEngine') || 'mistral';
|
||||
currentOcrEngine = localStorage.getItem('ocrEngine') || 'mineru';
|
||||
}
|
||||
|
||||
if (currentOcrEngine === 'none' || currentOcrEngine === 'local') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue