Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat: enhance document summary functionality with expandable/collapsible feature and overflow detection, improving user interaction

wizardchen1a4b7b390dd5
diff --git a/frontend/src/components/doc-content.vue b/frontend/src/components/doc-content.vue
index fa836a489..6f6596073 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<HTMLElement>();
+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 = () => {
</script>
<template>
<div class="doc_content" ref="mdContentWrap">
- <t-drawer :visible="visible" :zIndex="2000" :closeBtn="true" @close="handleClose">
+ <t-drawer :visible="visible" :zIndex="2000" :closeBtn="true" :footer="false" @close="handleClose">
<template #header>
<div class="drawer-header">
<span class="header-title">{{ getDisplayTitle() }}</span>
@@ -784,7 +802,12 @@ const handleDetailsScroll = () => {
<!-- 文档摘要 -->
<div v-if="details.description" class="summary_box">
<span class="label">{{ $t('knowledgeBase.documentSummary') }}</span>
- <div class="summary_content">{{ details.description }}</div>
+ <div class="summary_wrapper" :class="{ 'summary_clickable': summaryOverflow || summaryExpanded }" @click="(summaryOverflow || summaryExpanded) && (summaryExpanded = !summaryExpanded)">
+ <div ref="summaryRef" :class="['summary_content', { 'summary_collapsed': !summaryExpanded }]">{{ details.description }}</div>
+ <div v-if="(summaryOverflow && !summaryExpanded) || summaryExpanded" class="summary_fade" :class="{ 'summary_fade_expanded': summaryExpanded }">
+ <t-icon :name="summaryExpanded ? 'chevron-up' : 'chevron-down'" size="14px" class="summary_fade_icon" />
+ </div>
+ </div>
</div>
<div v-else-if="details.summary_status === 'pending' || details.summary_status === 'processing'" class="summary_box">
<span class="label">{{ $t('knowledgeBase.documentSummary') }}</span>
@@ -948,10 +971,6 @@ const handleDetailsScroll = () => {
/>
</div>
- <template #footer>
- <t-button @click="handleClose">{{ $t('common.confirm') }}</t-button>
- <t-button theme="default" @click="handleClose">{{ $t('common.cancel') }}</t-button>
- </template>
</t-drawer>
</div>
</template>
@@ -1056,15 +1075,50 @@ const handleDetailsScroll = () => {
font-size: 14px;
}
- .summary_content {
- padding: 12px;
+ .summary_wrapper {
+ position: relative;
background: var(--td-bg-color-container-hover);
border-radius: 4px;
+
+ &.summary_clickable {
+ cursor: pointer;
+ }
+ }
+
+ .summary_content {
+ padding: 12px;
color: var(--td-text-color-primary);
font-size: 13px;
line-height: 1.5;
word-break: break-word;
white-space: pre-wrap;
+
+ &.summary_collapsed {
+ max-height: 4.5em;
+ overflow: hidden;
+ }
+ }
+
+ .summary_fade {
+ display: flex;
+ justify-content: center;
+ padding-bottom: 4px;
+ pointer-events: none;
+
+ &:not(.summary_fade_expanded) {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ height: 28px;
+ background: linear-gradient(transparent, var(--td-bg-color-container-hover) 80%);
+ border-radius: 0 0 4px 4px;
+ align-items: flex-end;
+ }
+ }
+
+ .summary_fade_icon {
+ color: var(--td-text-color-placeholder);
}
.summary_loading {
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index 3b02a9f71..b7e06139d 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -1177,6 +1177,8 @@ export default {
defaultUser: 'User',
copyFailed: 'Copy failed',
retry: 'Retry',
+ expand: 'Expand',
+ collapse: 'Collapse',
},
mentionDetail: {
readOnlyFromAgent: 'Read-only in this conversation; not shown in Knowledge Base list',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index b9d070090..6822ccde8 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -1020,6 +1020,8 @@ export default {
defaultUser: "사용자",
copyFailed: "복사 실패",
retry: "재시도",
+ expand: "펼치기",
+ collapse: "접기",
},
mentionDetail: {
faqCount: "Q&A {count}개",
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 851056fd3..f5734fb12 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -1139,6 +1139,8 @@ export default {
defaultUser: 'Пользователь',
copyFailed: 'Ошибка копирования',
retry: 'Повторить',
+ expand: 'Развернуть',
+ collapse: 'Свернуть',
me: 'Я',
copy: 'Копировать',
copied: 'Скопировано'
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index f27e72352..ec524afd5 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -1024,6 +1024,8 @@ export default {
defaultUser: "用户",
copyFailed: "复制失败",
retry: "重试",
+ expand: "展开",
+ collapse: "收起",
},
mentionDetail: {
faqCount: "共 {count} 条问答",
diff --git a/frontend/src/views/agent/AgentEditorModal.vue b/frontend/src/views/agent/AgentEditorModal.vue
index 438674564..b6846e4bd 100644
--- a/frontend/src/views/agent/AgentEditorModal.vue
+++ b/frontend/src/views/agent/AgentEditorModal.vue
@@ -1218,6 +1218,7 @@ import { listSkills, type SkillInfo } from '@/api/skill';
import { listWebSearchProviders, type WebSearchProviderEntity } from '@/api/web-search-provider';
import { getAgentConfig, getConversationConfig, getStorageEngineStatus, type StorageEngineStatusItem, type PromptTemplate } from '@/api/system';
import { useUIStore } from '@/stores/ui';
+import { useAuthStore } from '@/stores/auth';
import { useOrganizationStore } from '@/stores/organization';
import AgentAvatar from '@/components/AgentAvatar.vue';
import PromptTemplateSelector from '@/components/PromptTemplateSelector.vue';
@@ -1226,6 +1227,7 @@ import AgentShareSettings from '@/components/AgentShareSettings.vue';
import IMChannelPanel from '@/components/IMChannelPanel.vue';
const uiStore = useUIStore();
+const authStore = useAuthStore();
const orgStore = useOrganizationStore();
const { t } = useI18n();
@@ -1453,8 +1455,8 @@ const navItems = computed(() => {
if (!isAgentMode.value) {
items.push({ key: 'conversation', icon: 'chat', label: t('agent.editor.conversationSettings') });
}
- // 共享管理(仅编辑模式且非内置智能体)
- if (props.mode === 'edit' && props.agent?.id && !props.agent?.is_builtin) {
+ // 共享管理(仅编辑模式且非内置智能体,Lite 模式下隐藏)
+ if (props.mode === 'edit' && props.agent?.id && !props.agent?.is_builtin && !authStore.isLiteMode) {
items.push({ key: 'share', icon: 'share', label: t('knowledgeEditor.sidebar.share') });
}
// IM集成(仅编辑模式,创建时Agent还没有ID)
diff --git a/frontend/src/views/agent/AgentList.vue b/frontend/src/views/agent/AgentList.vue
index 5c22e2f5c..2442cd9ce 100644
--- a/frontend/src/views/agent/AgentList.vue
+++ b/frontend/src/views/agent/AgentList.vue
@@ -1,6 +1,7 @@
<template>
<div class="agent-list-container">
<ListSpaceSidebar
+ v-if="!authStore.isLiteMode"
v-model="spaceSelection"
:count-all="allAgentsCount"
:count-mine="agents.length"
@@ -545,10 +546,12 @@ import type { SharedAgentInfo, OrganizationSharedAgentItem } from '@/api/organiz
import AgentEditorModal from './AgentEditorModal.vue'
import AgentAvatar from '@/components/AgentAvatar.vue'
import ListSpaceSidebar from '@/components/ListSpaceSidebar.vue'
+import { useAuthStore } from '@/stores/auth'
const { t } = useI18n()
const route = useRoute()
const router = useRouter()
+const authStore = useAuthStore()
const orgStore = useOrganizationStore()
interface AgentWithUI extends CustomAgent {
diff --git a/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue b/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue
index a904f02f6..f11d833c1 100644
--- a/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue
+++ b/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue
@@ -292,6 +292,7 @@ import { createKnowledgeBase, getKnowledgeBaseById, listKnowledgeFiles, updateKn
import { updateKBConfig, type KBModelConfigRequest } from '@/api/initialization'
import { listModels } from '@/api/model'
import { useUIStore } from '@/stores/ui'
+import { useAuthStore } from '@/stores/auth'
import KBModelConfig from './settings/KBModelConfig.vue'
import KBParserSettings from './settings/KBParserSettings.vue'
import KBStorageSettings from './settings/KBStorageSettings.vue'
@@ -304,6 +305,7 @@ import DataSourceSettings from './settings/DataSourceSettings.vue'
import { useI18n } from 'vue-i18n'
const uiStore = useUIStore()
+const authStore = useAuthStore()
const { t } = useI18n()
// Props
@@ -349,7 +351,7 @@ const navItems = computed(() => {
items.push({ key: 'datasource', icon: 'cloud-download', label: t('knowledgeEditor.sidebar.datasource'), badge: dsCount.value || undefined })
}
}
- if (props.mode === 'edit' && props.kbId) {
+ if (props.mode === 'edit' && props.kbId && !authStore.isLiteMode) {
items.push({ key: 'share', icon: 'share', label: t('knowledgeEditor.sidebar.share') })
}
return items
diff --git a/frontend/src/views/knowledge/KnowledgeBaseList.vue b/frontend/src/views/knowledge/KnowledgeBaseList.vue
index cebb0944e..13577a953 100644
--- a/frontend/src/views/knowledge/KnowledgeBaseList.vue
+++ b/frontend/src/views/knowledge/KnowledgeBaseList.vue
@@ -1,6 +1,7 @@
<template>
<div class="kb-list-container">
<ListSpaceSidebar
+ v-if="!authStore.isLiteMode"
v-model="spaceSelection"
:count-all="allKnowledgeBases"
:count-mine="kbs.length"
@@ -606,6 +607,7 @@ import { MessagePlugin, Icon as TIcon } from 'tdesign-vue-next'
import { listKnowledgeBases, deleteKnowledgeBase, togglePinKnowledgeBase } from '@/api/knowledge-base'
import { formatStringDate } from '@/utils/index'
import { useUIStore } from '@/stores/ui'
+import { useAuthStore } from '@/stores/auth'
import { useOrganizationStore } from '@/stores/organization'
import { listOrganizationSharedKnowledgeBases, type SharedKnowledgeBase, type OrganizationSharedKnowledgeBaseItem, type SourceFromAgentInfo } from '@/api/organization'
import KnowledgeBaseEditorModal from './KnowledgeBaseEditorModal.vue'
@@ -616,6 +618,7 @@ import { useI18n } from 'vue-i18n'
const router = useRouter()
const route = useRoute()
const uiStore = useUIStore()
+const authStore = useAuthStore()
const orgStore = useOrganizationStore()
const { t } = useI18n()