From 1a4b7b390dd5b95d7a488e4b0c854246b695db1e Mon Sep 17 00:00:00 2001 From: wizardchen Date: Sat, 11 Apr 2026 14:05:56 +0800 Subject: [PATCH] feat: enhance document summary functionality with expandable/collapsible feature and overflow detection, improving user interaction --- frontend/src/components/doc-content.vue | 70 ++++++++++++++++--- frontend/src/i18n/locales/en-US.ts | 2 + frontend/src/i18n/locales/ko-KR.ts | 2 + frontend/src/i18n/locales/ru-RU.ts | 2 + frontend/src/i18n/locales/zh-CN.ts | 2 + frontend/src/views/agent/AgentEditorModal.vue | 6 +- frontend/src/views/agent/AgentList.vue | 3 + .../knowledge/KnowledgeBaseEditorModal.vue | 4 +- .../src/views/knowledge/KnowledgeBaseList.vue | 3 + 9 files changed, 83 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/doc-content.vue b/frontend/src/components/doc-content.vue index fa836a48..6f659607 100644 --- a/frontend/src/components/doc-content.vue +++ b/frontend/src/components/doc-content.vue @@ -690,6 +690,24 @@ const getParentContent = (item: any) => { return parentContextCache.value.get(item.parent_chunk_id) || ''; }; +const summaryExpanded = ref(false); +const summaryRef = ref(); +const summaryOverflow = ref(false); + +const checkSummaryOverflow = () => { + nextTick(() => { + const el = summaryRef.value; + if (!el) { summaryOverflow.value = false; return; } + summaryOverflow.value = el.scrollHeight > el.clientHeight + 1; + }); +}; + +watch(() => props.details?.description, () => { + summaryExpanded.value = false; + checkSummaryOverflow(); +}); +watch(summaryRef, () => checkSummaryOverflow()); + const downloadFile = () => { downKnowledgeDetails(props.details.id) .then((result) => { @@ -734,7 +752,7 @@ const handleDetailsScroll = () => {