feat: 完善智能体图片聊天与会话恢复
- 增加私有图片上传、绑定、历史回显与生命周期清理 - 支持输入草稿恢复、图片交互和模型图片能力约束 - 修复旧脏会话幂等删除与前端会话恢复
This commit is contained in:
@@ -319,7 +319,7 @@ export const ChatTimelineBuilder = {
|
||||
metadata?: Partial<ChatTimelineMessageItem>,
|
||||
) {
|
||||
const text = normalizeText(content);
|
||||
if (!text) {
|
||||
if (!text && !metadata?.images?.length) {
|
||||
return;
|
||||
}
|
||||
const item: ChatTimelineMessageItem = {
|
||||
@@ -327,13 +327,15 @@ export const ChatTimelineBuilder = {
|
||||
role: 'user',
|
||||
status: 'done',
|
||||
createdAt: Date.now(),
|
||||
parts: [
|
||||
{
|
||||
id: createId('text'),
|
||||
content: text,
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
parts: text
|
||||
? [
|
||||
{
|
||||
id: createId('text'),
|
||||
content: text,
|
||||
type: 'text' as const,
|
||||
},
|
||||
]
|
||||
: [],
|
||||
type: 'message',
|
||||
...metadata,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user