From f5c6abf03f85bf995634bb1f10b96fa7d3064b9c Mon Sep 17 00:00:00 2001 From: iven Date: Sat, 11 Apr 2026 12:58:25 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E6=BC=94=E5=8C=96=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E6=9D=A1=E7=9B=AE=E5=A2=9E=E5=8A=A0=E5=8F=AF=E5=B1=95?= =?UTF-8?q?=E5=BC=80=E5=B7=AE=E5=BC=82=E8=A7=86=E5=9B=BE=20+=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=8F=98=E6=9B=B4=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 点击展开显示 soul/instructions/profile 变更内容,不再截断原因文本。 --- .../src/components/IdentityChangeProposal.tsx | 89 +++++++++++++++---- 1 file changed, 70 insertions(+), 19 deletions(-) diff --git a/desktop/src/components/IdentityChangeProposal.tsx b/desktop/src/components/IdentityChangeProposal.tsx index fe466bf..58c1954 100644 --- a/desktop/src/components/IdentityChangeProposal.tsx +++ b/desktop/src/components/IdentityChangeProposal.tsx @@ -275,30 +275,81 @@ function HistoryItem({ onRestore: () => void; isRestoring: boolean; }) { + const [expanded, setExpanded] = useState(false); const timeAgo = getTimeAgo(snapshot.timestamp); + // Determine which files changed + const fileEntries: Array<{ key: string; label: string; color: string; content: string }> = []; + if (snapshot.files?.soul) { + fileEntries.push({ key: 'soul', label: 'Soul', color: 'text-purple-600 dark:text-purple-400', content: snapshot.files.soul }); + } + if (snapshot.files?.instructions) { + fileEntries.push({ key: 'instructions', label: 'Instructions', color: 'text-blue-600 dark:text-blue-400', content: snapshot.files.instructions }); + } + if (snapshot.files?.user_profile) { + fileEntries.push({ key: 'user_profile', label: 'Profile', color: 'text-emerald-600 dark:text-emerald-400', content: snapshot.files.user_profile }); + } + return ( -
-
- -
-
-
- {timeAgo} - +
+
setExpanded(!expanded)} + > +
+ +
+
+
+ {timeAgo} +
+ {fileEntries.length > 0 && ( + + {fileEntries.length} 个文件 + + )} + +
+
+

+ {snapshot.reason || '自动快照'} +

+ {fileEntries.length > 0 && ( +
+ {fileEntries.map(({ key, label, color }) => ( + + {label} + + ))} +
+ )}
-

- {snapshot.reason || '自动快照'} -

+ + {expanded && fileEntries.length > 0 && ( +
+ {fileEntries.map(({ key, label, color, content }) => ( +
+
{label}
+
+                {content.slice(0, 500)}
+                {content.length > 500 ? '...' : ''}
+              
+
+ ))} +
+ )}
); }