From c5d3bf5dbbf3f741ba18f0804d6646856cc959b7 Mon Sep 17 00:00:00 2001 From: zoujing Date: Fri, 5 Jun 2026 16:31:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E9=AA=A8=E6=9E=B6?= =?UTF-8?q?=E5=B1=8F=E7=9A=84=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...egression-long-answer-section-skeleton.mjs | 129 ++++++++++++++++++ .../LongAnswerSectionSkeleton.vue | 81 +++++++++++ src/pages/ChatMain/ChatLongAnswer/index.vue | 53 ++++++- .../ChatMain/ChatLongAnswer/styles/index.scss | 2 +- 4 files changed, 262 insertions(+), 3 deletions(-) create mode 100644 scripts/regression-long-answer-section-skeleton.mjs create mode 100644 src/pages/ChatMain/ChatLongAnswer/LongAnswerSectionSkeleton.vue diff --git a/scripts/regression-long-answer-section-skeleton.mjs b/scripts/regression-long-answer-section-skeleton.mjs new file mode 100644 index 0000000..31fead1 --- /dev/null +++ b/scripts/regression-long-answer-section-skeleton.mjs @@ -0,0 +1,129 @@ +import assert from "assert"; +import { readFileSync } from "fs"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; + +const scriptDir = dirname(fileURLToPath(import.meta.url)); +const detailPagePath = resolve( + scriptDir, + "../src/pages/ChatMain/ChatLongAnswer/index.vue" +); +const parsedValuePath = resolve( + scriptDir, + "../src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue" +); +const detailStylePath = resolve( + scriptDir, + "../src/pages/ChatMain/ChatLongAnswer/styles/index.scss" +); +const skeletonComponentPath = resolve( + scriptDir, + "../src/pages/ChatMain/ChatLongAnswer/LongAnswerSectionSkeleton.vue" +); + +const detailPageSource = readFileSync(detailPagePath, "utf8"); +const parsedValueSource = readFileSync(parsedValuePath, "utf8"); +const detailStyleSource = readFileSync(detailStylePath, "utf8"); +const skeletonComponentSource = readFileSync(skeletonComponentPath, "utf8"); + +assert.match( + detailPageSource, + /const\s+streamFinished\s*=\s*ref/, + "long answer page should track whether the forwarded stream has finished" +); + +assert.match( + detailPageSource, + /import\s+LongAnswerSectionSkeleton\s+from\s+"\.\/LongAnswerSectionSkeleton\.vue"/, + "long answer page should use a sibling skeleton component" +); + +assert.doesNotMatch( + detailPageSource, + /DEFERRED_SPECIAL_SECTION_KEYS/, + "long answer page should not use a special-key whitelist for section skeletons" +); + +assert.doesNotMatch( + detailPageSource, + /LONG_TEXT_KEYS\.(sceneImage|contentImage|spotLocate|questionSuggest|commodityList|photoList|aigcComponet)/, + "section skeleton readiness should not be tied to named special keys" +); + +assert.match( + detailPageSource, + / + + + + + + + + + + + diff --git a/src/pages/ChatMain/ChatLongAnswer/index.vue b/src/pages/ChatMain/ChatLongAnswer/index.vue index 3c49859..8481a82 100644 --- a/src/pages/ChatMain/ChatLongAnswer/index.vue +++ b/src/pages/ChatMain/ChatLongAnswer/index.vue @@ -19,8 +19,11 @@