feat(frontend): improve manual knowledge editor and chat citation rendering

- Replace manual knowledge editor dialog with SettingDrawer and refine toolbar/footer layout
- Add draft status resolution for manual knowledge items in the knowledge base
- Fix citation placement near fenced code blocks and add regression tests
- Update ChatRequestInfoButton icon and chat message/citation styles
- Add i18n strings for manual knowledge editor features
This commit is contained in:
wizardchen
2026-06-17 20:50:42 +08:00
committed by lyingbug
parent 4c5379df9c
commit e0d3c1dafd
15 changed files with 396 additions and 269 deletions
@@ -269,7 +269,7 @@
</t-button>
<t-button size="small" variant="outline" shape="round" @click.stop="handleAddToKnowledge(event)"
:title="$t('agent.addToKnowledgeBase')">
<t-icon name="add" />
<t-icon name="bookmark-add" />
</t-button>
<t-tooltip v-if="event.is_fallback" :content="$t('chat.fallbackHint')" placement="top">
<t-button size="small" variant="outline" shape="round" class="fallback-icon-btn">
@@ -50,7 +50,7 @@
</t-button>
<t-button size="small" variant="outline" shape="round" @click.stop="handleAddToKnowledge"
:title="$t('agent.addToKnowledgeBase')">
<t-icon name="add" />
<t-icon name="bookmark-add" />
</t-button>
<!-- Fallback 提示图标 -->
<t-tooltip v-if="session.is_fallback" :content="$t('chat.fallbackHint')" placement="top">
+18 -4
View File
@@ -1843,13 +1843,27 @@ const {
},
});
const onCardClick = (item: any) => {
const isManualDraftKnowledge = (item: KnowledgeCard) =>
item.type === 'manual' && item.parse_status === 'draft';
const openKnowledgeItem = (item: KnowledgeCard) => {
if (shouldSuppressDocClick()) return;
if (canEdit.value && isManualDraftKnowledge(item)) {
const index = cardList.value.findIndex((c) => c.id === item.id);
if (index >= 0) {
handleManualEdit(index, item);
return;
}
}
openCardDetails(item);
};
const onCardClick = (item: KnowledgeCard) => {
if (batchMode.value) {
onCardGridCheckboxChange(item.id, !selectedIds.value.has(item.id));
} else {
openCardDetails(item);
return;
}
openKnowledgeItem(item);
};
const confirmBatchDelete = async () => {
@@ -2582,7 +2596,7 @@ async function createNewSession(value: string): Promise<void> {
</template>
<template v-else-if="cardList.length && viewMode === 'list'">
<DocumentListView :items="cardList" :selected-ids="selectedIds" :tag-list="tagList"
:can-edit="canEdit" @open="(item: any) => { if (!shouldSuppressDocClick()) openCardDetails(item); }" @toggle-row="toggleSelectRow"
:can-edit="canEdit" @open="(item: any) => openKnowledgeItem(item)" @toggle-row="toggleSelectRow"
@toggle-all="toggleSelectAll"
@action="(action: any, item: any) => handleListAction(action, item)" />
</template>