feat: 添加加载状态和空内容提示,优化文件详情展示

This commit is contained in:
Wenjie Zhang 2026-01-15 12:17:18 +08:00
parent 995c6041aa
commit 937355e390
3 changed files with 43 additions and 45 deletions

View File

@ -36,16 +36,14 @@ logs:
lint: lint:
uv run python -m ruff check . uv run python -m ruff check .
uv run python -m ruff format src --diff uv run python -m ruff format --check src
uv run python -m ruff check --select I src uv run python -m ruff check --select I src
format: format:
uv run ruff format . uv run python -m ruff format .
uv run ruff check . --fix uv run python -m ruff check . --fix
uv run python -m ruff check --select I src --fix uv run python -m ruff check --select I src --fix
cd web && npm run format
format_diff:
uv run ruff format --diff .
router-tests: router-tests:
docker compose exec -T api uv run --group test pytest test/api $(PYTEST_ARGS) docker compose exec -T api uv run --group test pytest test/api $(PYTEST_ARGS)

View File

@ -6,8 +6,8 @@ import zipfile
from pathlib import Path from pathlib import Path
import aiofiles import aiofiles
from docling.document_converter import DocumentConverter
from docling.datamodel.base_models import InputFormat from docling.datamodel.base_models import InputFormat
from docling.document_converter import DocumentConverter
from langchain_community.document_loaders import ( from langchain_community.document_loaders import (
CSVLoader, CSVLoader,
JSONLoader, JSONLoader,

View File

@ -60,7 +60,10 @@
</div> </div>
</div> </div>
</template> </template>
<div class="file-detail-content" v-if="file"> <div v-if="loading" class="loading-container">
<a-spin tip="正在加载文档内容..." />
</div>
<div v-else-if="file && hasContent" class="file-detail-content">
<!-- Markdown 模式 --> <!-- Markdown 模式 -->
<div v-if="viewMode === 'markdown'" class="content-panel"> <div v-if="viewMode === 'markdown'" class="content-panel">
<MdPreview <MdPreview
@ -93,8 +96,8 @@
</div> </div>
</div> </div>
<div v-else-if="loading" class="loading-container"> <div v-else-if="file" class="empty-content">
<a-spin /> <p>暂无文件内容</p>
</div> </div>
</a-modal> </a-modal>
</template> </template>
@ -489,55 +492,52 @@ const handleDownloadMarkdown = () => {
margin-right: 8px; margin-right: 8px;
} }
} }
</style>
<style lang="less">
/* MdPreview 覆盖样式 - 非 scoped */ /* MdPreview 覆盖样式 - 非 scoped */
.markdown-content { .content-panel {
.md-editor-preview-wrapper { .md-editor-preview-wrapper {
padding: 0; padding: 0;
} }
#md-editor-v-2-preview-wrapper { .md-editor-preview {
font-size: 14px; font-size: 14px;
line-height: 1.75; line-height: 1.75;
color: var(--gray-1000); color: var(--gray-1000);
}
#md-editor-v-2-preview-wrapper h1 { h1 {
font-size: 1.5rem; font-size: 1.2rem;
margin: 16px 0 12px; margin: 16px 0 12px;
font-weight: 600; font-weight: 600;
} }
#md-editor-v-2-preview-wrapper h2 { h2 {
font-size: 1.4rem; font-size: 1.2rem;
margin: 16px 0 12px; margin: 16px 0 12px;
font-weight: 600; font-weight: 600;
} }
#md-editor-v-2-preview-wrapper h3 { h3 {
font-size: 1.3rem; font-size: 1.1rem;
margin: 14px 0 10px; margin: 14px 0 10px;
font-weight: 600; font-weight: 600;
} }
#md-editor-v-2-preview-wrapper h4 { h4 {
font-size: 1.2rem; font-size: 1rem;
margin: 14px 0 10px; margin: 14px 0 10px;
font-weight: 600; font-weight: 600;
} }
#md-editor-v-2-preview-wrapper h5 { h5 {
font-size: 1.1rem; font-size: 1rem;
margin: 12px 0 8px; margin: 12px 0 8px;
font-weight: 600; font-weight: 600;
} }
#md-editor-v-2-preview-wrapper h6 { h6 {
font-size: 1rem; font-size: 1rem;
margin: 12px 0 8px; margin: 12px 0 8px;
font-weight: 600; font-weight: 600;
}
} }
} }
</style> </style>