Skip to content

fix: stabilize web demo flows and trim Element Plus bundles#3

Merged
magic-alt merged 3 commits into
feature/web-ui-vuefrom
fix/branch-rule-and-web-demo
May 21, 2026
Merged

fix: stabilize web demo flows and trim Element Plus bundles#3
magic-alt merged 3 commits into
feature/web-ui-vuefrom
fix/branch-rule-and-web-demo

Conversation

@magic-alt

Copy link
Copy Markdown
Owner

Summary

  • require a dedicated branch before any repo edits in the contributor and agent rules
  • fix the web demo flow end to end: document uploads now create storage layout, start analysis from the UI, and render real backend payload shapes without dashboard crashes
  • remove the Element Plus pagination deprecation warning and trim the frontend bundle so production builds no longer emit the >500 kB chunk warning

Validation

  • python -m ruff check src tests
  • python -m mypy src --ignore-missing-imports
  • python -m pytest -q --timeout=60
  • npm run lint
  • npm run typecheck
  • npm run build
  • browser check on the document list page confirmed the pagination warning no longer appears

Notes

Copilot AI review requested due to automatic review settings May 21, 2026 03:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stabilizes the end-to-end web demo flow (upload → analyze → dashboard rendering) while reducing Element Plus-related bundle size/warnings, and updates contributor/agent guidelines to require working on a dedicated branch.

Changes:

  • Web UI: trigger analysis after upload, support additional terminal task status (succeeded), remove Element Plus pagination deprecation warning, and improve robustness to backend payload shapes.
  • Frontend build/tooling: switch to on-demand Element Plus component resolution and split reporting dependencies into a separate Rollup chunk.
  • Backend/tests/docs: ensure upload creates the expected storage layout, return upload status, add a regression test for layout creation, and update CONTRIBUTING/AGENTS branch workflow guidance.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
web/vite.config.ts Adds Element Plus component auto-resolution, build base handling, and manual chunk splitting.
web/src/views/UploadView.vue Starts analysis immediately after upload and updates success messaging/navigation.
web/src/views/DocumentList.vue Updates pagination event wiring to remove deprecation warning; supports succeeded status.
web/src/views/DocumentDashboard.vue Treats succeeded as a terminal status and updates progress/header rendering accordingly.
web/src/main.ts Removes full Element Plus install and registers only needed directive/styles for smaller bundles.
web/src/components/OverviewPanel.vue Hardens metric iteration against unexpected backend shapes.
web/src/App.vue Wraps app in ElConfigProvider to preserve locale without full Element Plus install.
web/src/api/docs.ts Adds response-shape normalization and new analyze() API call; updates PDF URL construction.
web/src/api/client.ts Improves API base URL resolution and unwrap robustness (string/HTML detection).
web/package.json Adds unplugin-vue-components for on-demand component/style imports.
web/package-lock.json Locks the new dependency tree for unplugin-vue-components.
tests/test_routes_web.py Adds coverage ensuring upload creates the expected on-disk document layout.
src/api/routes.py Ensures document layout exists on upload and returns upload status in the response.
CONTRIBUTING.md Requires contributors to create a dedicated branch before editing files.
AGENTS.md Adds the same dedicated-branch requirement to agent guidelines.
Files not reviewed (1)
  • web/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to 31
const created = await docsApi.upload(opts.file as File, {
language: language.value === 'auto' ? undefined : language.value,
ocr: useOcr.value || undefined,
})
lastDocId.value = data.doc_id
ElMessage.success(`已创建任务: ${data.doc_id}`)
opts.onSuccess?.(data)
await docsApi.analyze(created.doc_id)
lastDocId.value = created.doc_id
ElMessage.success(`已创建并启动分析任务: ${created.doc_id}`)
opts.onSuccess?.(created)
// Jump to detail page so the user can watch progress live.
setTimeout(() => router.push(`/documents/${data.doc_id}`), 400)
setTimeout(() => router.push(`/documents/${created.doc_id}`), 400)
} catch (e: any) {
ElMessage.error(e.message || '上传失败')
opts.onError?.(e as any)
Comment thread web/src/api/docs.ts
Comment on lines +12 to +22
const DEFAULT_SOURCE: SourceRef = { page: 1, table_id: null, bbox: null, quote: null }

function normalizeSourceRef(raw: any): SourceRef {
if (!raw || typeof raw !== 'object') return DEFAULT_SOURCE
const page = Number(raw.page)
return {
page: Number.isFinite(page) && page > 0 ? page : 1,
table_id: raw.table_id ?? null,
bbox: raw.bbox ?? null,
quote: raw.quote ?? null,
}
Comment thread web/vite.config.ts
Comment on lines +10 to +12
export default defineConfig(({ command }) => ({
base: command === 'build' ? '/ui/' : '/',
plugins: [
@magic-alt magic-alt merged commit 810394e into feature/web-ui-vue May 21, 2026
3 checks passed
magic-alt added a commit that referenced this pull request May 21, 2026
Refresh Docker onboarding and preserve PR #3 lineage
magic-alt added a commit that referenced this pull request Jun 6, 2026
fix: stabilize web demo flows and trim Element Plus bundles
magic-alt added a commit that referenced this pull request Jun 6, 2026
magic-alt added a commit that referenced this pull request Jun 6, 2026
Refresh Docker onboarding and preserve PR #3 lineage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants