[前端+RAG] 异步上传+前端轮询自动刷新导读;PDF阅读模式合并行消除留白

This commit is contained in:
2026-04-02 17:17:36 +08:00
parent ee7c4a73ed
commit 5dcb8771ed
4 changed files with 182 additions and 56 deletions

View File

@@ -211,7 +211,7 @@ import {onMounted, onUnmounted, ref, reactive, provide, nextTick, computed, watc
import {
getKnowledgeBaseList, addKnowledgeBase, editKnowledgeBase, delKnowledgeBase,
getKnowledgeBaseContent, uploadFile, editFile, delFile, delFiles,
downloadFile, getFileContent, addFileNote, getSize
downloadFile, getFileContent, addFileNote, getSize, getFileGuide
} from "@/api";
import {withLoading} from "@/utils/loading";
import {copyToClip, getGlobalSelectionPosition} from "@/utils";
@@ -441,6 +441,18 @@ const handleNodeClick = async (data: any) => {
articleParagraph: doc.articleParagraph || '暂无内容,请重试',
fullContent: doc.context
};
// 从 API 获取最新的导读数据(后台线程可能已更新 MySQL
try {
const res = await getFileGuide(doc.id + '');
if (res?.code === 200 && res.data) {
const fresh = res.data;
if (fresh.articleAbstract) { selectedFile.value.articleAbstract = fresh.articleAbstract; data.raw.articleAbstract = fresh.articleAbstract; }
if (fresh.articleKeywords) { selectedFile.value.articleKeywords = fresh.articleKeywords; data.raw.articleKeywords = fresh.articleKeywords; }
if (fresh.articleParagraph) { selectedFile.value.articleParagraph = fresh.articleParagraph; data.raw.articleParagraph = fresh.articleParagraph; }
}
} catch {}
// 根据文件类型加载内容
readingMode.value = false;
const ext = doc.filename?.split('.').pop()?.toLowerCase() || '';