merge
This commit is contained in:
parent
482a09d397
commit
e07d4bb70b
8 changed files with 39 additions and 11 deletions
|
|
@ -256,6 +256,7 @@ export type Scheme = {
|
||||||
config: {
|
config: {
|
||||||
framework: 'lightrag' | 'raganything';
|
framework: 'lightrag' | 'raganything';
|
||||||
extractor?: 'mineru' | 'docling' | undefined; // Optional extractor field
|
extractor?: 'mineru' | 'docling' | undefined; // Optional extractor field
|
||||||
|
modelSource?: 'huggingface' | 'modelscope' | 'local' | undefined; // Optional model source field
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -379,9 +380,9 @@ export const getDocuments = async (): Promise<DocsStatusesResponse> => {
|
||||||
return response.data
|
return response.data
|
||||||
}
|
}
|
||||||
|
|
||||||
export const scanNewDocuments = async (framework?: string): Promise<ScanResponse> => {
|
export const scanNewDocuments = async (schemeConfig: any): Promise<ScanResponse> => {
|
||||||
const response = await axiosInstance.post('/documents/scan', {
|
const response = await axiosInstance.post('/documents/scan', {
|
||||||
framework
|
schemeConfig
|
||||||
})
|
})
|
||||||
return response.data
|
return response.data
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import { useTranslation } from 'react-i18next';
|
||||||
interface SchemeConfig {
|
interface SchemeConfig {
|
||||||
framework: 'lightrag' | 'raganything';
|
framework: 'lightrag' | 'raganything';
|
||||||
extractor?: 'mineru' | 'docling';
|
extractor?: 'mineru' | 'docling';
|
||||||
|
modelSource?: 'huggingface' | 'modelscope' | 'local';
|
||||||
}
|
}
|
||||||
|
|
||||||
const SchemeManagerDialog = () => {
|
const SchemeManagerDialog = () => {
|
||||||
|
|
@ -95,7 +96,7 @@ const SchemeManagerDialog = () => {
|
||||||
try {
|
try {
|
||||||
const newScheme = await addScheme({
|
const newScheme = await addScheme({
|
||||||
name: trimmedName,
|
name: trimmedName,
|
||||||
config: { framework: 'lightrag', extractor: undefined },
|
config: { framework: 'lightrag', extractor: undefined, modelSource: undefined },
|
||||||
});
|
});
|
||||||
|
|
||||||
// 更新方案列表
|
// 更新方案列表
|
||||||
|
|
@ -136,6 +137,7 @@ const SchemeManagerDialog = () => {
|
||||||
...updates,
|
...updates,
|
||||||
framework: updates.framework ?? selectedScheme.config?.framework ?? 'lightrag',
|
framework: updates.framework ?? selectedScheme.config?.framework ?? 'lightrag',
|
||||||
extractor: updates.extractor || selectedScheme.config?.extractor || (updates.framework === 'raganything' ? 'mineru' : undefined),
|
extractor: updates.extractor || selectedScheme.config?.extractor || (updates.framework === 'raganything' ? 'mineru' : undefined),
|
||||||
|
modelSource: updates.modelSource || selectedScheme.config?.modelSource || (updates.extractor === 'mineru' ? 'huggingface' : undefined),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -265,6 +267,21 @@ const SchemeManagerDialog = () => {
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{selectedScheme.config?.extractor === "mineru" && (
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm mb-1">{t('schemeManager.modelSource')}</label>
|
||||||
|
<select
|
||||||
|
value={selectedScheme.config?.modelSource || "huggingface"}
|
||||||
|
onChange={(e) => handleConfigChange({ modelSource: e.target.value as 'huggingface' | 'modelscope' | 'local' })}
|
||||||
|
className="w-full px-3 py-1.5 border rounded-md focus:outline-none"
|
||||||
|
>
|
||||||
|
<option value="huggingface">huggingface</option>
|
||||||
|
<option value="modelscope">modelscope</option>
|
||||||
|
<option value="local">local</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-col items-center justify-center h-[70%] text-gray-500">
|
<div className="flex flex-col items-center justify-center h-[70%] text-gray-500">
|
||||||
|
|
|
||||||
|
|
@ -636,9 +636,9 @@ export default function DocumentManager() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const framework = selectedScheme.config?.framework;
|
const schemeConfig = selectedScheme.config
|
||||||
|
|
||||||
const { status, message, track_id: _track_id } = await scanNewDocuments(framework); // eslint-disable-line @typescript-eslint/no-unused-vars
|
const { status, message, track_id: _track_id } = await scanNewDocuments(schemeConfig); // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
|
||||||
// Check again if component is still mounted after the request completes
|
// Check again if component is still mounted after the request completes
|
||||||
if (!isMountedRef.current) return;
|
if (!isMountedRef.current) return;
|
||||||
|
|
@ -664,7 +664,7 @@ export default function DocumentManager() {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Only show error if component is still mounted
|
// Only show error if component is still mounted
|
||||||
if (isMountedRef.current) {
|
if (isMountedRef.current) {
|
||||||
toast.error(t('documentPanel.documentManager.errors.scanFailed', { error: errorMessage(err) }));
|
toast.error(t('documentPanel.documentManager.errors.scanFiled', { error: errorMessage(err) }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [t, startPollingInterval, currentTab, health, statusCounts, selectedScheme])
|
}, [t, startPollingInterval, currentTab, health, statusCounts, selectedScheme])
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,8 @@
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "فشل تحميل المستندات\n{{error}}",
|
"loadFailed": "فشل تحميل المستندات\n{{error}}",
|
||||||
"scanFailed": "فشل مسح المستندات\n{{error}}",
|
"scanFailed": "فشل مسح المستندات\n{{error}}",
|
||||||
"scanProgressFailed": "فشل الحصول على تقدم المسح\n{{error}}"
|
"scanProgressFailed": "فشل الحصول على تقدم المسح\n{{error}}",
|
||||||
|
"missingSchemeId": "الحل هو في عداد المفقودين ، حدد الحل"
|
||||||
},
|
},
|
||||||
"fileNameLabel": "اسم الملف",
|
"fileNameLabel": "اسم الملف",
|
||||||
"showButton": "عرض",
|
"showButton": "عرض",
|
||||||
|
|
@ -429,6 +430,7 @@
|
||||||
"selectSchemePrompt": "يرجى تحديد أو إنشاء مخطط أولاً",
|
"selectSchemePrompt": "يرجى تحديد أو إنشاء مخطط أولاً",
|
||||||
"processingFramework": "إطار المعالجة",
|
"processingFramework": "إطار المعالجة",
|
||||||
"extractionTool": "أداة الاستخراج",
|
"extractionTool": "أداة الاستخراج",
|
||||||
|
"modelSource": "مصدر النموذج",
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "فشل تحميل المخططات",
|
"loadFailed": "فشل تحميل المخططات",
|
||||||
"nameEmpty": "لا يمكن أن يكون اسم المخطط فارغًا",
|
"nameEmpty": "لا يمكن أن يكون اسم المخطط فارغًا",
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,8 @@
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "Failed to load documents\n{{error}}",
|
"loadFailed": "Failed to load documents\n{{error}}",
|
||||||
"scanFailed": "Failed to scan documents\n{{error}}",
|
"scanFailed": "Failed to scan documents\n{{error}}",
|
||||||
"scanProgressFailed": "Failed to get scan progress\n{{error}}"
|
"scanProgressFailed": "Failed to get scan progress\n{{error}}",
|
||||||
|
"missingSchemeId": "Lack of solution, please select a solution"
|
||||||
},
|
},
|
||||||
"fileNameLabel": "File Name",
|
"fileNameLabel": "File Name",
|
||||||
"showButton": "Show",
|
"showButton": "Show",
|
||||||
|
|
@ -429,6 +430,7 @@
|
||||||
"selectSchemePrompt": "Please select or create a scheme first",
|
"selectSchemePrompt": "Please select or create a scheme first",
|
||||||
"processingFramework": "Processing Framework",
|
"processingFramework": "Processing Framework",
|
||||||
"extractionTool": "Extraction Tool",
|
"extractionTool": "Extraction Tool",
|
||||||
|
"modelSource": "Model Source",
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "Failed to load schemes",
|
"loadFailed": "Failed to load schemes",
|
||||||
"nameEmpty": "Scheme name cannot be empty",
|
"nameEmpty": "Scheme name cannot be empty",
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,8 @@
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "Échec du chargement des documents\n{{error}}",
|
"loadFailed": "Échec du chargement des documents\n{{error}}",
|
||||||
"scanFailed": "Échec de la numérisation des documents\n{{error}}",
|
"scanFailed": "Échec de la numérisation des documents\n{{error}}",
|
||||||
"scanProgressFailed": "Échec de l'obtention de la progression de la numérisation\n{{error}}"
|
"scanProgressFailed": "Échec de l'obtention de la progression de la numérisation\n{{error}}",
|
||||||
|
"missingSchemeId": "Schéma de traitement manquant, veuillez sélectionner un schéma de traitement"
|
||||||
},
|
},
|
||||||
"fileNameLabel": "Nom du fichier",
|
"fileNameLabel": "Nom du fichier",
|
||||||
"showButton": "Afficher",
|
"showButton": "Afficher",
|
||||||
|
|
@ -429,6 +430,7 @@
|
||||||
"selectSchemePrompt": "Veuillez d'abord sélectionner ou créer un schéma",
|
"selectSchemePrompt": "Veuillez d'abord sélectionner ou créer un schéma",
|
||||||
"processingFramework": "Framework de traitement",
|
"processingFramework": "Framework de traitement",
|
||||||
"extractionTool": "Outil d'extraction",
|
"extractionTool": "Outil d'extraction",
|
||||||
|
"modelSource": "Source du modèle",
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "Échec du chargement des schémas",
|
"loadFailed": "Échec du chargement des schémas",
|
||||||
"nameEmpty": "Le nom du schéma ne peut pas être vide",
|
"nameEmpty": "Le nom du schéma ne peut pas être vide",
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,8 @@
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "加载文档失败\n{{error}}",
|
"loadFailed": "加载文档失败\n{{error}}",
|
||||||
"scanFailed": "扫描文档失败\n{{error}}",
|
"scanFailed": "扫描文档失败\n{{error}}",
|
||||||
"scanProgressFailed": "获取扫描进度失败\n{{error}}"
|
"scanProgressFailed": "获取扫描进度失败\n{{error}}",
|
||||||
|
"missingSchemeId": "缺少处理方案,请选择处理方案"
|
||||||
},
|
},
|
||||||
"fileNameLabel": "文件名",
|
"fileNameLabel": "文件名",
|
||||||
"showButton": "显示",
|
"showButton": "显示",
|
||||||
|
|
@ -429,6 +430,7 @@
|
||||||
"selectSchemePrompt": "请先选择或创建一个方案",
|
"selectSchemePrompt": "请先选择或创建一个方案",
|
||||||
"processingFramework": "处理框架",
|
"processingFramework": "处理框架",
|
||||||
"extractionTool": "提取工具",
|
"extractionTool": "提取工具",
|
||||||
|
"modelSource": "模型源",
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "加载方案失败",
|
"loadFailed": "加载方案失败",
|
||||||
"nameEmpty": "方案名称不能为空",
|
"nameEmpty": "方案名称不能为空",
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,8 @@
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "載入文件失敗\n{{error}}",
|
"loadFailed": "載入文件失敗\n{{error}}",
|
||||||
"scanFailed": "掃描文件失敗\n{{error}}",
|
"scanFailed": "掃描文件失敗\n{{error}}",
|
||||||
"scanProgressFailed": "取得掃描進度失敗\n{{error}}"
|
"scanProgressFailed": "取得掃描進度失敗\n{{error}}",
|
||||||
|
"missingSchemeId": "缺少處理方案,請選擇處理方案"
|
||||||
},
|
},
|
||||||
"fileNameLabel": "檔案名稱",
|
"fileNameLabel": "檔案名稱",
|
||||||
"showButton": "顯示",
|
"showButton": "顯示",
|
||||||
|
|
@ -429,6 +430,7 @@
|
||||||
"selectSchemePrompt": "請先選擇或建立一個方案",
|
"selectSchemePrompt": "請先選擇或建立一個方案",
|
||||||
"processingFramework": "處理框架",
|
"processingFramework": "處理框架",
|
||||||
"extractionTool": "提取工具",
|
"extractionTool": "提取工具",
|
||||||
|
"modelSource": "模型源",
|
||||||
"errors": {
|
"errors": {
|
||||||
"loadFailed": "載入方案失敗",
|
"loadFailed": "載入方案失敗",
|
||||||
"nameEmpty": "方案名稱不能為空",
|
"nameEmpty": "方案名稱不能為空",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue