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

@@ -196,7 +196,7 @@ function removeStatusItem(items: ChatTimelineItem[], statusKey: string) {
const index = items.findIndex(
(item) => item.type === 'status' && item.statusKey === statusKey,
);
if (index >= 0) {
if (index !== -1) {
items.splice(index, 1);
}
}
@@ -341,7 +341,7 @@ export const ChatTimelineBuilder = {
metadata?: Partial<ChatTimelineMessageItem>,
) {
const text = normalizeText(content);
if (!text && !metadata?.images?.length) {
if (!text && !metadata?.images?.length && !metadata?.documents?.length) {
return;
}
const item: ChatTimelineMessageItem = {
@@ -605,7 +605,7 @@ export const ChatTimelineBuilder = {
item.role === 'assistant' &&
item.roundId === roundId,
);
if (targetIndex >= 0) {
if (targetIndex !== -1) {
items.splice(targetIndex, 1, message);
}
},