From eb4d8700811fd109fcab56f7eb5d9edaf352fb00 Mon Sep 17 00:00:00 2001 From: liangxu Date: Tue, 30 Jun 2026 16:23:33 +0800 Subject: [PATCH] fix: add functions to handle and strip Deep Seek link icon nodes --- .../src/views/TrackingQuestionDetailView.vue | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/apps/admin-web/src/views/TrackingQuestionDetailView.vue b/apps/admin-web/src/views/TrackingQuestionDetailView.vue index 4252a67..23fb746 100644 --- a/apps/admin-web/src/views/TrackingQuestionDetailView.vue +++ b/apps/admin-web/src/views/TrackingQuestionDetailView.vue @@ -647,6 +647,35 @@ function shouldStripDeepSeekOrphanAnchor(anchor: HTMLAnchorElement): boolean { ) } +function isDeepSeekLinkIconSvg(svg: SVGElement): boolean { + const viewBox = svg.getAttribute('viewBox')?.trim() ?? '' + const width = svg.getAttribute('width')?.trim() ?? '' + const height = svg.getAttribute('height')?.trim() ?? '' + const paths = Array.from(svg.querySelectorAll('path')) + return ( + viewBox === '0 0 14 14' && + width === '14' && + height === '14' && + paths.length === 2 && + paths.every((path) => path.getAttribute('fill') === 'currentColor') + ) +} + +function stripDeepSeekLinkIconNodes(root: HTMLElement): void { + for (const svg of Array.from(root.querySelectorAll('svg'))) { + if (!isDeepSeekLinkIconSvg(svg)) { + continue + } + const parent = svg.parentElement + const parentText = parent?.textContent?.trim() ?? '' + if (parent && parent !== root && parent.children.length === 1 && parentText === '') { + parent.remove() + continue + } + svg.remove() + } +} + function collectDeepSeekCitationReferenceLabels( platform: MonitoringQuestionDetailPlatform | null, ): string[][] { @@ -970,6 +999,8 @@ function renderDeepSeekAnswerContent( const fallbackLabels = new Map() const fallbackState = { nextIndex: 1 } + stripDeepSeekLinkIconNodes(root) + for (const anchor of Array.from(root.querySelectorAll('a[href], a'))) { const rawHref = anchor.hasAttribute('href') ? anchor.getAttribute('href') || anchor.href || ''