perf: 收敛前端按需加载与图标导入

- 延迟加载第三方登录组件并使用按需 SVG 图标入口

- 修复 CardList 图标依赖并整理组件格式
This commit is contained in:
2026-07-27 19:42:03 +08:00
parent 908eb5583d
commit 24b1142738
8 changed files with 38 additions and 35 deletions

View File

@@ -1,8 +1,9 @@
<script setup lang="ts">
import type {ChatTimelineKnowledgeHit} from './types';
import type { ChatTimelineKnowledgeHit } from './types';
import {BookOpenText, X} from '@easyflow/icons';
import {computed, ref} from 'vue';
import { computed, ref } from 'vue';
import { BookOpenText, X } from '@easyflow/icons';
interface KnowledgeCitation {
id: string;
@@ -50,13 +51,15 @@ function resolveGroupKey(item: ChatTimelineKnowledgeHit, index: number) {
return `faq:${label || asText(item.knowledgeId) || index}`;
}
const sourceName = asText(item.documentName) || sourceFileName(item);
return [
'doc',
sourceName || asText(item.sourceUri) || label || asText(item.documentId),
asText(item.knowledgeId),
]
.filter(Boolean)
.join(':') || `doc:${index}`;
return (
[
'doc',
sourceName || asText(item.sourceUri) || label || asText(item.documentId),
asText(item.knowledgeId),
]
.filter(Boolean)
.join(':') || `doc:${index}`
);
}
function formatScore(score: ChatTimelineKnowledgeHit['score']) {
@@ -65,7 +68,9 @@ function formatScore(score: ChatTimelineKnowledgeHit['score']) {
}
const numberValue = Number(score);
if (Number.isFinite(numberValue)) {
return numberValue > 1 ? numberValue.toFixed(2) : `${Math.round(numberValue * 100)}%`;
return numberValue > 1
? numberValue.toFixed(2)
: `${Math.round(numberValue * 100)}%`;
}
return String(score);
}
@@ -97,8 +102,8 @@ const citations = computed<KnowledgeCitation[]>(() => {
return [...groups.values()];
});
const activeCitation = computed(
() => citations.value.find((citation) => citation.id === activeId.value),
const activeCitation = computed(() =>
citations.value.find((citation) => citation.id === activeId.value),
);
function toggleCitation(id: string) {
@@ -318,7 +323,7 @@ function toggleCitation(id: string) {
.chat-knowledge-card__popover-meta span + span::before {
margin-right: 6px;
color: var(--el-border-color);
content: "·";
content: '·';
}
.chat-knowledge-card__close {
@@ -369,7 +374,7 @@ function toggleCitation(id: string) {
.chat-knowledge-card__meta span + span::before {
margin-right: 6px;
color: var(--el-border-color);
content: "/";
content: '/';
}
.chat-knowledge-card__content {