fix: stabilize web demo flows and trim Element Plus bundles#3
Merged
Conversation
There was a problem hiding this comment.
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 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 on lines
+10
to
+12
| export default defineConfig(({ command }) => ({ | ||
| base: command === 'build' ? '/ui/' : '/', | ||
| plugins: [ |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
Notes
feature/web-ui-vue) to keep review focused on the incremental fixes