Skip to content

🤯 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.

🐛 fix(space): show document update time (#14366)

AmAzing-ce516fff9d35
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index ed5384fe91c..dcbcf763dce 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -848,6 +848,7 @@
"workingPanel.resources.renameEmpty": "Title cannot be empty",
"workingPanel.resources.renameError": "Failed to rename document",
"workingPanel.resources.renameSuccess": "Document renamed",
+ "workingPanel.resources.updatedAt": "Updated {{time}}",
"workingPanel.resources.viewMode.list": "List view",
"workingPanel.resources.viewMode.tree": "Tree view",
"workingPanel.review.binary": "Binary file — diff not shown",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 21d49879b02..15713378441 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -853,6 +853,7 @@
"workingPanel.resources.renameEmpty": "标题不能为空",
"workingPanel.resources.renameError": "重命名失败",
"workingPanel.resources.renameSuccess": "重命名成功",
+ "workingPanel.resources.updatedAt": "更新于 {{time}}",
"workingPanel.resources.viewMode.list": "列表视图",
"workingPanel.resources.viewMode.tree": "树状视图",
"workingPanel.review.binary": "二进制文件,无法展示 diff",
diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts
index c0d9067c93b..69b65b0dca5 100644
--- a/src/locales/default/chat.ts
+++ b/src/locales/default/chat.ts
@@ -909,6 +909,7 @@ export default {
'workingPanel.resources.renameEmpty': 'Title cannot be empty',
'workingPanel.resources.renameError': 'Failed to rename document',
'workingPanel.resources.renameSuccess': 'Document renamed',
+ 'workingPanel.resources.updatedAt': 'Updated {{time}}',
'workingPanel.resources.viewMode.list': 'List view',
'workingPanel.resources.viewMode.tree': 'Tree view',
'workingPanel.review.binary': 'Binary file — diff not shown',
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx
index 428b98f9ea9..0527a92bc66 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.test.tsx
@@ -52,7 +52,7 @@ vi.mock('@/libs/swr', () => ({
vi.mock('react-i18next', () => ({
useTranslation: () => ({
- t: (key: string) =>
+ t: (key: string, options?: { time?: string }) =>
(
({
'workingPanel.resources.empty': 'No agent documents yet',
@@ -60,6 +60,7 @@ vi.mock('react-i18next', () => ({
'workingPanel.resources.filter.all': 'All',
'workingPanel.resources.filter.documents': 'Documents',
'workingPanel.resources.filter.web': 'Web',
+ 'workingPanel.resources.updatedAt': `Updated ${options?.time}`,
}) as Record<string, string>
)[key] || key,
}),
@@ -129,6 +130,7 @@ describe('AgentDocumentsGroup', () => {
sourceType: 'file',
templateId: 'claw',
title: 'Brief',
+ updatedAt: new Date(),
},
],
error: undefined,
@@ -142,9 +144,10 @@ describe('AgentDocumentsGroup', () => {
render(<AgentDocumentsGroup />);
- const item = await screen.findByText('Brief');
+ const item = screen.getByText('Brief');
expect(item).toBeInTheDocument();
expect(screen.getByText('A short brief')).toBeInTheDocument();
+ expect(screen.getByText('Updated a few seconds ago')).toBeInTheDocument();
fireEvent.click(item);
expect(openDocument).toHaveBeenCalledWith('doc-content-1');
@@ -162,6 +165,7 @@ describe('AgentDocumentsGroup', () => {
sourceType: 'file',
templateId: 'claw',
title: 'Brief',
+ updatedAt: new Date(),
},
{
createdAt: new Date('2026-04-16T00:00:00Z'),
@@ -172,6 +176,7 @@ describe('AgentDocumentsGroup', () => {
sourceType: 'web',
templateId: null,
title: 'Example',
+ updatedAt: new Date(),
},
],
error: undefined,
@@ -211,6 +216,7 @@ describe('AgentDocumentsGroup', () => {
sourceType: 'file',
templateId: 'claw',
title: 'Brief',
+ updatedAt: new Date(),
},
],
error: undefined,
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx
index 08727db680e..7022eb16e7f 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx
@@ -116,7 +116,12 @@ const DocumentItem = memo<DocumentItemProps>(({ agentId, document, mutate }) =>
const description = document.description ?? undefined;
const isWeb = document.sourceType === 'web';
const IconComponent: LucideIcon = isWeb ? GlobeIcon : FileTextIcon;
- const createdAtLabel = document.createdAt ? dayjs(document.createdAt).fromNow() : null;
+ const updatedAtLabel = document.updatedAt
+ ? t('workingPanel.resources.updatedAt', {
+ ns: 'chat',
+ time: dayjs(document.updatedAt).fromNow(),
+ })
+ : null;
const activeDocumentId = pageMatch ? pageMatch.params.docId : portalDocumentId;
const isActive = activeDocumentId === document.documentId;
@@ -190,7 +195,7 @@ const DocumentItem = memo<DocumentItemProps>(({ agentId, document, mutate }) =>
{description}
</Text>
)}
- {createdAtLabel && <Text className={styles.meta}>{createdAtLabel}</Text>}
+ {updatedAtLabel && <Text className={styles.meta}>{updatedAtLabel}</Text>}
</Flexbox>
</Flexbox>
);