chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,66 @@
|
||||
# Source location rendering regressions
|
||||
|
||||
From `frontend`, run `npm run dev -- --host 127.0.0.1 --port 5199`, then open
|
||||
`http://127.0.0.1:5199/tests/source-locate/index.html` in a browser.
|
||||
The page runs 55 cases against the actual Vue previews, PDF.js, docx-preview,
|
||||
SheetJS and EPUB renderer. Each result is displayed as PASS/FAIL. The page is
|
||||
outside the production entry point and is not included in the app build.
|
||||
|
||||
The five `parsedFixtures.json` cases are generated by the real Python PDFium
|
||||
parser. Regenerate from the repository root after changing parsing or geometry:
|
||||
|
||||
```sh
|
||||
docreader/.venv/bin/python -m docreader.tests.generate_source_location_browser_fixtures
|
||||
```
|
||||
|
||||
The fixtures contain only generated test text. No user documents or remote
|
||||
parser services are needed. Assertions check page identity, ambiguity rejection,
|
||||
nonempty finite geometry, region containment, all fragments of cross-page
|
||||
citations, stale evidence, and rapid document destruction/recreation.
|
||||
|
||||
The pure resolver's separate Node tests cover page 501, cancellation, partial
|
||||
mapping, numeric meaning, and DOMRect prototype properties. Python tests cover
|
||||
native PDF parsing, crop/rotation, duplicate paragraphs and protobuf transport.
|
||||
|
||||
## Private local replay
|
||||
|
||||
Open the same page with `?local=1` to replay `local/manifest.json`. The `local/`
|
||||
directory ignores all fixture files, so uploaded documents and query logs are
|
||||
never added to Git. Each manifest entry provides `name`, `file`, `ext`,
|
||||
`request` (a `SourceLocateRequest`), expected `precise`, and expected PDF
|
||||
`pages`, and optional `firstPage` for the initial navigation target. Files are served only by the local development server. The replay
|
||||
checks actual highlighted pages and precision status, not merely whether a
|
||||
preview opened. Keep real user files out of `parsedFixtures.json`.
|
||||
|
||||
The generated DOCX cases also check an OCR image bracketed by unique source
|
||||
paragraphs, missing/duplicate image contexts, images at chunk boundaries,
|
||||
and a valid sentence within a partially mapped chunk.
|
||||
|
||||
PDF cases include column-serialized tables with repeated course names and
|
||||
paired row values, and image-heavy cross-page instructions with corrupted font
|
||||
arrows. Separate resolver tests reject wrong grades, mismatched rows, duplicate
|
||||
tables, and numeric changes. Partial highlights never claim full chunk coverage.
|
||||
|
||||
DOCX regressions also verify exact image-byte identity, ambiguous duplicate images,
|
||||
and private replay assertions for the exact highlighted excerpt and image digest.
|
||||
|
||||
Markdown regressions render cited raw Markdown using the same sanitized renderer
|
||||
as the preview. They cover fenced language names, literal tags inside code,
|
||||
exact commands, paragraph-level paraphrases, multi-paragraph citations, ambiguous
|
||||
duplicate sources, missing source scopes, and changed numeric values. DOM anchor
|
||||
cases verify that a citation keeps all preceding sentences since the previous
|
||||
citation. Private Markdown fixtures must provide `request.sourceMarkdown` before
|
||||
markup stripping; `highlightText` asserts the exact highlighted source paragraphs.
|
||||
|
||||
Manual Markdown cases cover table-and-paragraph citations without source locators,
|
||||
scrolling to the highlighted passage, and rejecting changed or duplicate evidence.
|
||||
Run `npm test -- src/components/ChatReferenceSourceView.test.ts` to also verify
|
||||
manual citation routing, Markdown preview type, same-document citation changes,
|
||||
summary/card behavior, and stale or mismatched chunk rejection.
|
||||
|
||||
Chunk-boundary cases assert complete original paragraph context when a child
|
||||
ends or starts mid-paragraph. Candidate paragraphs must intersect a uniquely
|
||||
verified source region with at least eight normalized characters. Duplicate
|
||||
source scopes, modified values and unrelated adjacent paragraphs cannot use this
|
||||
completion path. A repeated paragraph keeps the occurrence established by the
|
||||
full source scope. Exact explicit quotations still retain their narrow range.
|
||||
Reference in new issue
Block a user