feat: 支持智能体文档附件与轻量读取

- 建立文档上传、异步读取、对象存储、补偿与聊天绑定闭环

- 按智能体 20K 上下文预算选择文档片段并保留稳定引用

- 统一聊天文件卡片、类型图标、草稿恢复与可靠下载
This commit is contained in:
2026-07-29 01:32:19 +08:00
parent fceedd02cd
commit d45c67a317
72 changed files with 5876 additions and 237 deletions

View File

@@ -1,7 +1,8 @@
<script setup lang="ts">
import type {
ChatTimelineItem,
ChatDocumentLoader,
ChatImageLoader,
ChatTimelineItem,
ChatTimelineMessageItem,
ChatTimelineMessagePart,
ChatTimelineToolApprovalPayload,
@@ -10,9 +11,10 @@ import type {
import { computed, ref } from 'vue';
import ChatThinkingBlock from '../chat-thinking/ChatThinkingBlock.vue';
import ChatDocumentAttachments from './ChatDocumentAttachments.vue';
import ChatErrorNotice from './ChatErrorNotice.vue';
import ChatKnowledgeCard from './ChatKnowledgeCard.vue';
import ChatImageAttachments from './ChatImageAttachments.vue';
import ChatKnowledgeCard from './ChatKnowledgeCard.vue';
import ChatMessageToolbar from './ChatMessageToolbar.vue';
import ChatTextBlock from './ChatTextBlock.vue';
import ChatTimelineStatusRow from './ChatTimelineStatusRow.vue';
@@ -20,13 +22,14 @@ import ChatToolCard from './ChatToolCard.vue';
const props = defineProps<{
approvalLoading?: boolean;
assistantActionsVisible?: boolean;
copyable?: boolean;
copyAction?: (item: ChatTimelineMessageItem) => boolean | Promise<boolean>;
regenerable?: boolean;
regenerateDisabled?: boolean;
assistantActionsVisible?: boolean;
documentLoader?: ChatDocumentLoader;
imageLoader?: ChatImageLoader;
item: ChatTimelineItem;
regenerable?: boolean;
regenerateDisabled?: boolean;
variantLoading?: boolean;
}>();
@@ -161,6 +164,12 @@ function handleCopyAction() {
:image-loader="imageLoader"
compact
/>
<ChatDocumentAttachments
v-if="messageItem.documents?.length"
:items="messageItem.documents"
:document-loader="documentLoader"
compact
/>
<template v-for="part in getMessageParts(messageItem)" :key="part.id">
<ChatThinkingBlock
v-if="part.type === 'thinking'"
@@ -237,16 +246,16 @@ function handleCopyAction() {
display: flex;
flex-direction: column;
gap: 8px;
max-width: min(78%, 680px);
min-width: 0;
max-width: min(78%, 680px);
}
.chat-timeline-item__message {
display: flex;
flex-direction: column;
gap: 8px;
max-width: min(78%, 680px);
min-width: 0;
max-width: min(78%, 680px);
}
.chat-timeline-item__message :deep(.chat-text-block),