Fix bugs where Rewind and Resume showed Ugly and 100X too verbose content. (#17940)

This commit is contained in:
Jacob Richman
2026-01-30 10:09:27 -08:00
committed by GitHub
parent f14d0c6a17
commit bb6a336ca9
16 changed files with 212 additions and 20 deletions

View File

@@ -130,6 +130,7 @@ describe('ChatRecordingService', () => {
chatRecordingService.recordMessage({
type: 'user',
content: 'Hello',
displayContent: 'User Hello',
model: 'gemini-pro',
});
expect(mkdirSyncSpy).toHaveBeenCalled();
@@ -139,6 +140,7 @@ describe('ChatRecordingService', () => {
) as ConversationRecord;
expect(conversation.messages).toHaveLength(1);
expect(conversation.messages[0].content).toBe('Hello');
expect(conversation.messages[0].displayContent).toBe('User Hello');
expect(conversation.messages[0].type).toBe('user');
});

View File

@@ -47,6 +47,7 @@ export interface BaseMessageRecord {
id: string;
timestamp: string;
content: PartListUnion;
displayContent?: PartListUnion;
}
/**
@@ -207,12 +208,14 @@ export class ChatRecordingService {
private newMessage(
type: ConversationRecordExtra['type'],
content: PartListUnion,
displayContent?: PartListUnion,
): MessageRecord {
return {
id: randomUUID(),
timestamp: new Date().toISOString(),
type,
content,
displayContent,
};
}
@@ -223,12 +226,17 @@ export class ChatRecordingService {
model: string | undefined;
type: ConversationRecordExtra['type'];
content: PartListUnion;
displayContent?: PartListUnion;
}): void {
if (!this.conversationFile) return;
try {
this.updateConversation((conversation) => {
const msg = this.newMessage(message.type, message.content);
const msg = this.newMessage(
message.type,
message.content,
message.displayContent,
);
if (msg.type === 'gemini') {
// If it's a new Gemini message then incorporate any queued thoughts.
conversation.messages.push({