🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(home): support attachments when creating tasks (#20518)
Arvin Xudafaf477f3dc
diff --git a/locales/en-US/home.json b/locales/en-US/home.jsonindex d2aab478f9f..6eb27be552f 100644--- a/locales/en-US/home.json+++ b/locales/en-US/home.json@@ -111,11 +111,12 @@"dashboard.rail.show": "Show activity","dashboard.scheduledTask.title": "Scheduled tasks","dashboard.submitFailed": "Could not submit. Your draft has been kept.",+ "dashboard.task.attachmentsNotReady": "Wait for attachments to finish uploading, or retry failed uploads. Your draft has been kept.","dashboard.task.created": "Task created","dashboard.task.createdHint": "Find it in Recent tasks.","dashboard.task.empty": "No tasks yet","dashboard.task.title": "Recent tasks",- "dashboard.task.unsupportedContext": "Task mode does not support attachments or selected context yet. Remove them or switch to Agent mode; your draft has been kept.",+ "dashboard.task.unsupportedContext": "Task mode does not support selected context yet. Remove them or switch to Agent mode; your draft has been kept.","dashboard.task.viewAll": "View all","homePromoBanner.cta": "Try now","homePromoBanner.dismiss": "Dismiss",diff --git a/locales/zh-CN/home.json b/locales/zh-CN/home.jsonindex 7eff31e65a6..a5bd0bc3b3d 100644--- a/locales/zh-CN/home.json+++ b/locales/zh-CN/home.json@@ -111,11 +111,12 @@"dashboard.rail.show": "显示动态","dashboard.scheduledTask.title": "定时任务","dashboard.submitFailed": "提交失败,草稿已保留。",+ "dashboard.task.attachmentsNotReady": "请等待附件上传完成,或重试失败的上传。草稿已保留。","dashboard.task.created": "任务已创建","dashboard.task.createdHint": "可在「最近任务」中查看。","dashboard.task.empty": "暂无任务","dashboard.task.title": "最近任务",- "dashboard.task.unsupportedContext": "任务模式暂不支持附件或已选上下文。请移除它们或切换到 Agent 模式;草稿已保留。",+ "dashboard.task.unsupportedContext": "任务模式暂不支持已选上下文。请移除它们或切换到 Agent 模式;草稿已保留。","dashboard.task.viewAll": "查看全部","homePromoBanner.cta": "立即体验","homePromoBanner.dismiss": "关闭",diff --git a/packages/locales/src/default/home.ts b/packages/locales/src/default/home.tsindex 65bfd919f45..4e0a819a784 100644--- a/packages/locales/src/default/home.ts+++ b/packages/locales/src/default/home.ts@@ -118,13 +118,15 @@ export default {'dashboard.rail.show': 'Show activity','dashboard.scheduledTask.title': 'Scheduled tasks','dashboard.submitFailed': 'Could not submit. Your draft has been kept.',+ 'dashboard.task.attachmentsNotReady':+ 'Wait for attachments to finish uploading, or retry failed uploads. Your draft has been kept.','dashboard.task.created': 'Task created','dashboard.task.createdHint': 'Find it in Recent tasks.','dashboard.task.empty': 'No tasks yet','dashboard.task.title': 'Recent tasks','dashboard.task.viewAll': 'View all','dashboard.task.unsupportedContext':- 'Task mode does not support attachments or selected context yet. Remove them or switch to Agent mode; your draft has been kept.',+ 'Task mode does not support selected context yet. Remove them or switch to Agent mode; your draft has been kept.','inbox.author.scheduled': 'Scheduled','inbox.error.title': 'Run failed','inbox.goals.review': 'Needs your decision',diff --git a/src/features/ChatInput/ActionBar/Upload/index.tsx b/src/features/ChatInput/ActionBar/Upload/index.tsxindex 7851180ffbf..be873f38bd0 100644--- a/src/features/ChatInput/ActionBar/Upload/index.tsx+++ b/src/features/ChatInput/ActionBar/Upload/index.tsx@@ -31,7 +31,11 @@ const hotArea = css`}`;-const FileUpload = memo(() => {+interface FileUploadProps {+ includeKnowledge?: boolean;+}++const FileUpload = memo<FileUploadProps>(({ includeKnowledge = true }) => {const { t } = useTranslation('chat');const enableKnowledgeBase = useServerConfigStore(@@ -58,7 +62,10 @@ const FileUpload = memo(() => {const [dropdownOpen, setDropdownOpen] = useState(false);const [updating, setUpdating] = useState(false);- const knowledgeItems = useKnowledgeMenuItems({ onUpdatingChange: setUpdating });+ const knowledgeItems = useKnowledgeMenuItems({+ enabled: includeKnowledge,+ onUpdatingChange: setUpdating,+ });// Viewer doesn't have `file:upload` permission — backend would 403.// Render the disabled paperclip with a tooltip so the entry stays visible@@ -66,7 +73,7 @@ const FileUpload = memo(() => {// otherwise let users trigger the upload anyway.const { allowed: canUpload, reason } = usePermission('create_content');- if (!enableKnowledgeBase) return null;+ if (includeKnowledge && !enableKnowledgeBase) return null;if (!canUpload) {return (@@ -210,7 +217,7 @@ const FileUpload = memo(() => {<Suspensefallback={<ChatInputAction disabled icon={Paperclip} title={t('upload.action.tooltip')} />}>- {showTip ? (+ {includeKnowledge && showTip ? (<TipGuideopen={showTip}placement={'top'}diff --git a/src/features/ChatInput/ActionBar/Upload/useKnowledgeMenuItems.test.ts b/src/features/ChatInput/ActionBar/Upload/useKnowledgeMenuItems.test.tsindex 29b746ea1a3..dbab848d201 100644--- a/src/features/ChatInput/ActionBar/Upload/useKnowledgeMenuItems.test.ts+++ b/src/features/ChatInput/ActionBar/Upload/useKnowledgeMenuItems.test.ts@@ -51,6 +51,17 @@ describe('useKnowledgeMenuItems', () => {expect(result.current).toEqual([]);});+ it('omits all agent resource controls for upload-only tasks', () => {+ mockFiles.current = [{ enabled: true, id: 'file-1', name: 'Brief', type: 'text/plain' }];+ mockKnowledgeBases.current = [{ enabled: true, id: 'kb-1', name: 'Handbook' }];++ const { result } = renderHook(() =>+ useKnowledgeMenuItems({ enabled: false, onUpdatingChange: vi.fn() }),+ );++ expect(result.current).toEqual([]);+ });+it('offers the picker entry alongside the empty hint when nothing is attached', () => {const { result } = renderHook(() => useKnowledgeMenuItems({ onUpdatingChange: vi.fn() }));diff --git a/src/features/ChatInput/ActionBar/Upload/useKnowledgeMenuItems.tsx b/src/features/ChatInput/ActionBar/Upload/useKnowledgeMenuItems.tsxindex a1e998780a5..5ba61f70778 100644--- a/src/features/ChatInput/ActionBar/Upload/useKnowledgeMenuItems.tsx+++ b/src/features/ChatInput/ActionBar/Upload/useKnowledgeMenuItems.tsx@@ -31,8 +31,10 @@ export const MENU_ICON_SIZE = 20;* applies to its Attachments submenu.*/export const useKnowledgeMenuItems = ({+ enabled = true,onUpdatingChange,}: {+ enabled?: boolean;onUpdatingChange: (updating: boolean) => void;}): ItemType[] => {const { t } = useTranslation('chat');@@ -50,7 +52,7 @@ export const useKnowledgeMenuItems = ({s.toggleKnowledgeBase,]);- if (!canConfigureResource) return [];+ if (!enabled || !canConfigureResource) return [];const items: ItemType[] = [];diff --git a/src/features/Home/InputArea/EditorInput.tsx b/src/features/Home/InputArea/EditorInput.tsxindex b205c088caa..4877c8862fd 100644--- a/src/features/Home/InputArea/EditorInput.tsx+++ b/src/features/Home/InputArea/EditorInput.tsx@@ -10,6 +10,7 @@ import {type SendButtonHandler,} from '@/features/ChatInput';import ActionBar from '@/features/ChatInput/ActionBar';+import FileUpload from '@/features/ChatInput/ActionBar/Upload';import { useChatStore } from '@/store/chat';import type { HomeMode } from '../types';@@ -100,8 +101,10 @@ const HomeEditorInput = memo<HomeEditorInputProps>(leftContent={<Flexbox horizontal align={'center'} gap={2}><ModeSelect value={mode} onChange={onModeChange} />- {mode !== 'chat' ? null : isAgentConfigLoading ? (+ {isAgentConfigLoading ? (<ActionIcon disabled icon={PlusIcon} size={'small'} />+ ) : mode === 'task' ? (+ <FileUpload includeKnowledge={false} />) : (<ActionBar disableCollapse dropdownPlacement="bottomLeft" />)}diff --git a/src/features/Home/InputArea/index.tsx b/src/features/Home/InputArea/index.tsxindex 2e7185e4b2d..148764f9c15 100644--- a/src/features/Home/InputArea/index.tsx+++ b/src/features/Home/InputArea/index.tsx@@ -101,17 +101,13 @@ const InputArea = ({return (<Flexbox><Flexbox ref={chatInputRef}>- {mode === 'chat' ? (- <InputDragUpload- radius={20}- style={{ position: 'relative', zIndex: 1 }}- onUploadFiles={handleUploadFiles}- >- {editorSlot}- </InputDragUpload>- ) : (- editorSlot- )}+ <InputDragUpload+ radius={20}+ style={{ position: 'relative', zIndex: 1 }}+ onUploadFiles={handleUploadFiles}+ >+ {editorSlot}+ </InputDragUpload>{showInputBanners && (<InputBannerQueue>{showNewModelShortcuts && (diff --git a/src/features/Home/InputArea/taskAttachments.test.ts b/src/features/Home/InputArea/taskAttachments.test.tsnew file mode 100644index 00000000000..ce7525e8dae--- /dev/null+++ b/src/features/Home/InputArea/taskAttachments.test.ts@@ -0,0 +1,50 @@+import type { UploadFileItem } from '@lobechat/types';+import { extractMediaFromEditorState } from '@lobehub/editor';+import type { SerializedEditorState } from 'lexical';+import { describe, expect, it } from 'vitest';++import { appendTaskAttachments } from './taskAttachments';++const files: UploadFileItem[] = [+ {+ file: new File(['pdf'], 'report.pdf', { type: 'application/pdf' }),+ fileUrl: 'https://example.com/f/pdf',+ id: 'pdf',+ status: 'success',+ },+ {+ file: new File(['image'], 'photo.png', { type: 'image/png' }),+ fileUrl: 'https://example.com/f/image',+ id: 'image',+ status: 'success',+ },+];++describe('appendTaskAttachments', () => {+ it('preserves rich text and exposes documents and images to the editor media extractor', () => {+ const editorData = {+ root: {+ children: [+ {+ children: [{ text: 'Rich draft', type: 'text', format: 1, version: 1 }],+ type: 'paragraph',+ version: 1,+ },+ ],+ type: 'root',+ version: 1,+ },+ };+ const result = appendTaskAttachments(editorData, 'Rich draft', files) as SerializedEditorState;+ expect(result.root.children[0]).toEqual(editorData.root.children[0]);+ expect(editorData.root.children).toHaveLength(1);+ const { fileList, imageList } = extractMediaFromEditorState(result);+ expect(fileList.map((item) => item.url)).toEqual(['https://example.com/f/pdf']);+ expect(imageList.map((item) => item.url)).toEqual(['https://example.com/f/image']);+ });++ it('preserves text when no editor state is available', () => {+ const result = appendTaskAttachments(undefined, 'Draft text', files) as SerializedEditorState;+ expect(result.root.children[0]).toMatchObject({ children: [{ text: 'Draft text' }] });+ });+});diff --git a/src/features/Home/InputArea/taskAttachments.ts b/src/features/Home/InputArea/taskAttachments.tsnew file mode 100644index 00000000000..c3c2030f0aa--- /dev/null+++ b/src/features/Home/InputArea/taskAttachments.ts@@ -0,0 +1,83 @@+import type { UploadFileItem } from '@lobechat/types';+import { toRecord } from '@lobechat/utils/object';++/** Persist Home's external upload tray using the task editor's attachment format. */+export const appendTaskAttachments = (+ editorData: unknown,+ message: string,+ files: UploadFileItem[],+): unknown => {+ if (files.length === 0) return editorData;++ const data = toRecord(editorData) ?? {};+ const root = toRecord(data.root) ?? {};+ const children = Array.isArray(root.children)+ ? root.children+ : message+ ? [+ {+ children: [+ {+ detail: 0,+ format: 0,+ mode: 'normal',+ style: '',+ text: message,+ type: 'text',+ version: 1,+ },+ ],+ direction: null,+ format: '',+ indent: 0,+ type: 'paragraph',+ version: 1,+ },+ ]+ : [];++ return {+ ...data,+ root: {+ direction: null,+ format: '',+ indent: 0,+ type: 'root',+ version: 1,+ ...root,+ children: [+ ...children,+ ...files.map(({ file, fileUrl, dimensions }) =>+ file.type.startsWith('image/')+ ? {+ altText: file.name,+ height: dimensions?.height ?? 0,+ maxWidth: 800,+ src: fileUrl,+ status: 'uploaded',+ type: 'block-image',+ version: 1,+ width: dimensions?.width ?? 0,+ }+ : {+ children: [+ {+ fileUrl,+ name: file.name,+ size: file.size,+ status: 'uploaded',+ type: 'file',+ version: 1,+ },+ ],+ direction: null,+ format: '',+ indent: 0,+ type: 'paragraph',+ version: 1,+ },+ ),+ ],+ },+ };+};diff --git a/src/features/Home/InputArea/useSend.test.ts b/src/features/Home/InputArea/useSend.test.tsindex a0229b68f19..b5dd30eda87 100644--- a/src/features/Home/InputArea/useSend.test.ts+++ b/src/features/Home/InputArea/useSend.test.ts@@ -182,6 +182,13 @@ describe('Home InputArea useSend', () => {sendMessageMock.mockReset();clearContentMock.mockReset();clearChatUploadFileListMock.mockReset();+ clearChatUploadFileListMock.mockImplementation((submittedIds?: string[]) => {+ fileState.chatUploadFileList = submittedIds+ ? fileState.chatUploadFileList.filter(+ (file: { id: string }) => !submittedIds.includes(file.id),+ )+ : [];+ });clearChatContextSelectionsMock.mockReset();restoreChatContextSelectionsMock.mockReset();createTaskMock.mockReset();@@ -276,6 +283,14 @@ describe('Home InputArea useSend', () => {});it('keeps the draft and stays on Home when task creation throws', async () => {+ fileState.chatUploadFileList = [+ {+ id: 'file-1',+ file: new File(['report'], 'report.pdf'),+ fileUrl: 'https://example.com/f/file-1',+ status: 'success',+ },+ ] as any;createTaskMock.mockRejectedValue(new Error('create failed'));const { result } = renderHook(() => useSend('task'));const params: Parameters<SendButtonHandler>[0] = {@@ -292,12 +307,21 @@ describe('Home InputArea useSend', () => {expect(runTaskMock).not.toHaveBeenCalled();expect(routerMock.push).not.toHaveBeenCalled();expect(clearContentMock).not.toHaveBeenCalled();+ expect(clearChatUploadFileListMock).not.toHaveBeenCalled();expect(messageSuccessMock).not.toHaveBeenCalled();expect(messageErrorMock).toHaveBeenCalledWith('dashboard.submitFailed');});- it('does not discard attachments that Task mode cannot persist', async () => {- fileState.chatUploadFileList = [{ id: 'file-1' }] as any;+ it('persists uploaded attachments when creating a task', async () => {+ fileState.chatUploadFileList = [+ {+ id: 'file-1',+ file: new File(['report'], 'report.pdf', { type: 'application/pdf' }),+ fileUrl: 'https://example.com/f/file-1',+ status: 'success',+ },+ ] as any;+ createTaskMock.mockResolvedValue({ identifier: 'T-27' });const { result } = renderHook(() => useSend('task'));const params: Parameters<SendButtonHandler>[0] = {clearContent: vi.fn(),@@ -310,14 +334,77 @@ describe('Home InputArea useSend', () => {await result.current.send(params);});- expect(createTaskMock).not.toHaveBeenCalled();- expect(clearChatUploadFileListMock).not.toHaveBeenCalled();- expect(messageErrorMock).toHaveBeenCalledWith('dashboard.task.unsupportedContext');+ expect(createTaskMock).toHaveBeenCalledTimes(1);+ const created = createTaskMock.mock.calls[0][0];+ expect(created.editorData.root.children).toEqual(+ expect.arrayContaining([+ expect.objectContaining({+ children: [+ expect.objectContaining({+ type: 'file',+ fileUrl: 'https://example.com/f/file-1',+ name: 'report.pdf',+ status: 'uploaded',+ }),+ ],+ }),+ ]),+ );+ expect(clearChatUploadFileListMock).toHaveBeenCalledTimes(1);+ expect(messageErrorMock).not.toHaveBeenCalled();+ });++ it('preserves uploads added while task creation is pending', async () => {+ const submittedFile = {+ id: 'submitted',+ file: new File(['first'], 'first.txt'),+ fileUrl: 'https://example.com/first',+ status: 'success',+ };+ const newFile = {+ id: 'new-upload',+ file: new File(['second'], 'second.txt'),+ status: 'uploading',+ };+ fileState.chatUploadFileList = [submittedFile] as any;+ let completeCreation!: (value: { identifier: string }) => void;+ createTaskMock.mockImplementation(+ () =>+ new Promise((resolve) => {+ completeCreation = resolve;+ }),+ );+ const { result } = renderHook(() => useSend('task'));+ const params: Parameters<SendButtonHandler>[0] = {+ clearContent: vi.fn(),+ editor: {} as Parameters<SendButtonHandler>[0]['editor'],+ getEditorData: () => undefined,+ getMarkdownContent: () => 'First task',+ };+ let submission!: Promise<void>;+ act(() => {+ submission = Promise.resolve(result.current.send(params));+ });+ fileState.chatUploadFileList = [submittedFile, newFile] as any;+ await act(async () => {+ completeCreation({ identifier: 'T-28' });+ await submission;+ });+ expect(fileState.chatUploadFileList).toEqual([newFile]);+ expect(JSON.stringify(createTaskMock.mock.calls[0][0].editorData)).not.toContain('second.txt');});- it('explains why an attachment-only Task submission cannot proceed', async () => {+ it('creates a task from an attachment-only submission', async () => {chatState.inputMessage = '';- fileState.chatUploadFileList = [{ id: 'file-1' }] as any;+ fileState.chatUploadFileList = [+ {+ id: 'file-1',+ file: new File(['report'], 'report.pdf', { type: 'application/pdf' }),+ fileUrl: 'https://example.com/f/file-1',+ status: 'success',+ },+ ] as any;+ createTaskMock.mockResolvedValue({ identifier: 'T-27' });const { result } = renderHook(() => useSend('task'));const params: Parameters<SendButtonHandler>[0] = {clearContent: vi.fn(),@@ -330,11 +417,49 @@ describe('Home InputArea useSend', () => {await result.current.send(params);});- expect(createTaskMock).not.toHaveBeenCalled();- expect(clearChatUploadFileListMock).not.toHaveBeenCalled();- expect(messageErrorMock).toHaveBeenCalledWith('dashboard.task.unsupportedContext');+ expect(createTaskMock).toHaveBeenCalledTimes(1);+ const created = createTaskMock.mock.calls[0][0];+ expect(created.instruction).toBe('report.pdf');+ expect(created.name).toBe('report.pdf');+ expect(created.editorData.root.children).toEqual(+ expect.arrayContaining([+ expect.objectContaining({+ children: [+ expect.objectContaining({+ type: 'file',+ fileUrl: 'https://example.com/f/file-1',+ name: 'report.pdf',+ status: 'uploaded',+ }),+ ],+ }),+ ]),+ );+ expect(clearChatUploadFileListMock).toHaveBeenCalledTimes(1);+ expect(messageErrorMock).not.toHaveBeenCalled();});+ it.each(['pending', 'uploading', 'error'])(+ 'retains the attachment draft when upload is %s',+ async (status) => {+ fileState.chatUploadFileList = [+ { id: 'file-1', file: new File(['report'], 'report.pdf'), status },+ ] as any;+ const { result } = renderHook(() => useSend('task'));+ await act(async () => {+ await result.current.send({+ clearContent: vi.fn(),+ editor: {} as Parameters<SendButtonHandler>[0]['editor'],+ getMarkdownContent: () => 'Report',+ });+ });+ expect(createTaskMock).not.toHaveBeenCalled();+ expect(clearContentMock).not.toHaveBeenCalled();+ expect(clearChatUploadFileListMock).not.toHaveBeenCalled();+ expect(messageErrorMock).toHaveBeenCalledWith('dashboard.task.attachmentsNotReady');+ },+ );+it('routes cold homepage sends to the created topic instead of relying on ChatHydration timing', async () => {const { result } = renderHook(() => useSend());const params: Parameters<SendButtonHandler>[0] = {diff --git a/src/features/Home/InputArea/useSend.ts b/src/features/Home/InputArea/useSend.tsindex 8b0eb40d60f..9488be22f76 100644--- a/src/features/Home/InputArea/useSend.ts+++ b/src/features/Home/InputArea/useSend.ts@@ -22,6 +22,7 @@ import { useTaskStore } from '@/store/task';import { useResolvedHomeAgentId } from '../AgentSelect/useResolvedHomeAgentId';import type { HomeMode } from '../types';+import { appendTaskAttachments } from './taskAttachments';import { taskNameFromMessage } from './taskName';/**@@ -117,10 +118,8 @@ export const useSend = (mode: HomeMode = 'chat') => {if ((mode === 'task' || !inputActiveMode) && !canUseResource) return;- // Task persistence does not support attachments or context yet. Check- // this before the empty-message guard so an attachment-only submission- // explains why it cannot proceed instead of appearing inert.- if (mode === 'task' && (fileList.length > 0 || contextList.length > 0)) {+ // Selected context is separate from the task editor's persisted attachments.+ if (mode === 'task' && contextList.length > 0) {toast.error(t('dashboard.task.unsupportedContext'));return;}@@ -138,13 +137,17 @@ export const useSend = (mode: HomeMode = 'chat') => {// action on the task itself, so a quick jot cannot launch an agent the// user only meant to note down.if (mode === 'task') {- if (!message || !selectedAgentId) return;+ if (!selectedAgentId) return;+ if (fileList.some((file) => file.status !== 'success' || !file.fileUrl)) {+ toast.error(t('dashboard.task.attachmentsNotReady'));+ return;+ }setIsSubmitting(true);- const name = taskNameFromMessage(message);+ const name = taskNameFromMessage(message || fileList[0]?.file.name || '');const created = await createTask({assigneeAgentId: selectedAgentId,- editorData,- instruction: message,+ editorData: appendTaskAttachments(editorData, message, fileList),+ instruction: message || name,name,visibility: activeWorkspaceId ? 'private' : undefined,});@@ -253,7 +256,7 @@ export const useSend = (mode: HomeMode = 'chat') => {// Preserve the complete draft when creation or execution fails. The// editor, files and context are one unit from the user's perspective.if (submitted) {- clearChatUploadFileList();+ clearChatUploadFileList(mode === 'task' ? fileList.map((file) => file.id) : undefined);clearChatContextSelections(contextSelectionKey);mainInputEditor?.clearContent();}diff --git a/src/store/file/slices/chat/action.test.ts b/src/store/file/slices/chat/action.test.tsindex a0884a09a43..4cf80fc25af 100644--- a/src/store/file/slices/chat/action.test.ts+++ b/src/store/file/slices/chat/action.test.ts@@ -205,6 +205,20 @@ describe('useFileStore:chat', () => {expect(result.current.chatUploadFileList).toEqual([]);});+ it('clears only submitted uploads while retaining newer files and their status', () => {+ const { result } = renderHook(() => useStore());+ const newerFile = { id: 'new', status: 'uploading' };+ act(() => {+ useStore.setState({ chatUploadFileList: [{ id: 'submitted' }, newerFile] as any });+ result.current.clearChatUploadFileList(['submitted']);+ });+ expect(result.current.chatUploadFileList).toEqual([newerFile]);+ act(() => {+ result.current.clearChatUploadFileList([]);+ });+ expect(result.current.chatUploadFileList).toEqual([newerFile]);+ });+it('uploadChatFiles should reject unsupported files before upload in chat mode', async () => {// chat mode: agent mode disabled and not a heterogeneous agentmockAgentMode({ enableAgentMode: false, heterogeneous: false });diff --git a/src/store/file/slices/chat/action.ts b/src/store/file/slices/chat/action.tsindex 04cc5ea404f..6214160e59e 100644--- a/src/store/file/slices/chat/action.ts+++ b/src/store/file/slices/chat/action.ts@@ -119,8 +119,11 @@ export class FileActionImpl {this.#set({ chatContextSelectionsByContext: nextMap }, false, n('clearChatContextSelections'));};- clearChatUploadFileList = (): void => {- this.#set({ chatUploadFileList: [] }, false, n('clearChatUploadFileList'));+ clearChatUploadFileList = (submittedIds?: string[]): void => {+ const chatUploadFileList = submittedIds+ ? this.#get().chatUploadFileList.filter((file) => !submittedIds.includes(file.id))+ : [];+ this.#set({ chatUploadFileList }, false, n('clearChatUploadFileList'));};dispatchChatUploadFileList = (payload: UploadFileListDispatch): void => {