({ message }: { message: CustomMessage })
| 1053 | } |
| 1054 | |
| 1055 | function CompactionMessageView({ message }: { message: CustomMessage }) { |
| 1056 | const summary = getMessageText(message.content); |
| 1057 | const parsedSummary = useMemo(() => parseCompactionSummary(summary), [summary]); |
| 1058 | const time = formatTime(message.timestamp); |
| 1059 | |
| 1060 | return ( |
| 1061 | <div style={{ marginBottom: 16 }}> |
| 1062 | <div |
| 1063 | style={{ |
| 1064 | border: "1px solid var(--border)", |
| 1065 | borderRadius: 8, |
| 1066 | overflow: "hidden", |
| 1067 | background: "var(--bg)", |
| 1068 | }} |
| 1069 | > |
| 1070 | <div |
| 1071 | style={{ |
| 1072 | display: "flex", |
| 1073 | alignItems: "center", |
| 1074 | gap: 8, |
| 1075 | padding: "7px 10px", |
| 1076 | borderBottom: "1px solid var(--border)", |
| 1077 | background: "var(--bg-panel)", |
| 1078 | color: "var(--text-muted)", |
| 1079 | }} |
| 1080 | > |
| 1081 | <span style={{ fontFamily: "var(--font-mono)", fontSize: 11, fontWeight: 650 }}> |
| 1082 | compaction |
| 1083 | </span> |
| 1084 | {time && <span style={{ marginLeft: "auto", color: "var(--text-dim)", fontSize: 10 }}>{time}</span>} |
| 1085 | </div> |
| 1086 | |
| 1087 | <div style={{ padding: "11px 13px 12px" }}> |
| 1088 | <div style={{ color: "var(--text)", fontSize: 15, fontWeight: 700, lineHeight: 1.35 }}> |
| 1089 | Conversation compacted |
| 1090 | </div> |
| 1091 | <div style={{ marginTop: 3, marginBottom: 10, color: "var(--text)", fontSize: 14, lineHeight: 1.5 }}> |
| 1092 | The conversation history before this point was compacted into the following summary: |
| 1093 | </div> |
| 1094 | {parsedSummary.body ? ( |
| 1095 | <MarkdownBody className="markdown-compaction-message">{parsedSummary.body}</MarkdownBody> |
| 1096 | ) : ( |
| 1097 | <span style={{ color: "var(--text-dim)", fontSize: 12 }}>(no summary)</span> |
| 1098 | )} |
| 1099 | <CompactionFileMetadata readFiles={parsedSummary.readFiles} modifiedFiles={parsedSummary.modifiedFiles} /> |
| 1100 | </div> |
| 1101 | </div> |
| 1102 | </div> |
| 1103 | ); |
| 1104 | } |
| 1105 | |
| 1106 | function CompactionFileMetadata({ readFiles, modifiedFiles }: { readFiles: string[]; modifiedFiles: string[] }) { |
| 1107 | const total = readFiles.length + modifiedFiles.length; |
nothing calls this directly
no test coverage detected