perf: 收敛前端按需加载与图标导入
- 延迟加载第三方登录组件并使用按需 SVG 图标入口 - 修复 CardList 图标依赖并整理组件格式
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { SvgDingDingIcon } from '@easyflow/icons';
|
||||
import { SvgDingDingIcon } from '@easyflow/icons/svg';
|
||||
import { $t } from '@easyflow/locales';
|
||||
|
||||
import { alert, useEasyFlowModal } from '@easyflow-core/popup-ui';
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { EasyFlowFormSchema } from '@easyflow-core/form-ui';
|
||||
|
||||
import type { AuthenticationProps } from './types';
|
||||
|
||||
import { computed, onMounted, reactive, ref } from 'vue';
|
||||
import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { $t } from '@easyflow/locales';
|
||||
@@ -14,7 +14,6 @@ import { useEasyFlowForm } from '@easyflow-core/form-ui';
|
||||
import { EasyFlowButton, EasyFlowCheckbox } from '@easyflow-core/shadcn-ui';
|
||||
|
||||
import Title from './auth-title.vue';
|
||||
import ThirdPartyLogin from './third-party-login.vue';
|
||||
|
||||
interface Props extends AuthenticationProps {
|
||||
formSchema?: EasyFlowFormSchema[];
|
||||
@@ -47,6 +46,10 @@ const emit = defineEmits<{
|
||||
submit: [Recordable<any>];
|
||||
}>();
|
||||
|
||||
const ThirdPartyLogin = defineAsyncComponent(
|
||||
() => import('./third-party-login.vue'),
|
||||
);
|
||||
|
||||
const [Form, formApi] = useEasyFlowForm(
|
||||
reactive({
|
||||
commonConfig: {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
SvgGoogleIcon,
|
||||
SvgQQChatIcon,
|
||||
SvgWeChatIcon,
|
||||
} from '@easyflow/icons';
|
||||
} from '@easyflow/icons/svg';
|
||||
import { $t } from '@easyflow/locales';
|
||||
|
||||
import { EasyFlowIconButton } from '@easyflow-core/shadcn-ui';
|
||||
|
||||
Reference in New Issue
Block a user