Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deep-cody): update chat memory management #6264

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Dec 5, 2024

This PR introduces the following improvements to the CodyChatMemory module:

  • Transition to a static utility class with a Map-based storage approach
  • Implement timestamp-based memory organization and automatic trimming to maintain the 10 most recent items
  • Enhance the retrieve() method to return a formatted ContextItem with the memory content
  • Introduce comprehensive unit tests to cover various chat session workflows

Test plan

  • Run the unit tests for the CodyChatMemory module
  • Verify the chat memory functionality in the Cody extension, including adding, retrieving, and clearing memories

Changelog

This PR introduces the following improvements to the CodyChatMemory module:

- Transition to a static utility class with a Map-based storage approach
- Implement timestamp-based memory organization and automatic trimming to maintain the 10 most recent items
- Enhance the retrieve() method to return a formatted ContextItem with the memory content
- Add support for REMOVE command to clear the chat memory
- Introduce comprehensive unit tests to cover various chat session workflows

## Test plan

- Run the unit tests for the CodyChatMemory module
- Verify the chat memory functionality in the Cody extension, including adding, retrieving, and clearing memories

## Changelog

- Improved chat memory management with timestamp-based organization and automatic trimming
- Added support for REMOVE command to clear the chat memory
- Enhanced unit test coverage for chat memory workflows
return stored
}

private getChatMemory(): string[] {
return localStorage?.getChatMemory() || []
}
}

export const CHAT_MEMORY_CONTEXT_TEMPLATE = `# Chat Memory
Copy link
Collaborator

@PriNova PriNova Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about keeping the prompt more generally? Similar to the following:
'Here are important memos/notes from past conversations' (Up to you about the phrasing)

This would also make it possible for users to store notes that are not directly related to them, but correspond to specifications/requirements and may not confuse Cody.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PriNova Are you referring to the about me (user) part of the prompt?

Something like:

Here are the notes from our past conversations

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PriNova Are you referring to the about me (user) part of the prompt?

Something like:

Here are the notes from our past conversations

Yes. I missed the correct line comment. It is meant for the prompt.

@abeatrix abeatrix marked this pull request as draft December 6, 2024 00:09
@ichim-david
Copy link
Contributor

ichim-david commented Dec 6, 2024

@abeatrix I think that it would be awesome to have an Array of values stored that you can retrieve and easily say to forget by index + 1.
Ex:

  1. My name is David
  2. I use React
  3. I use Tailwind

Forget 2
Now, the tool only has 1 and 3 in it's memory store.

The users have requested having the ability to target the forget and not have an all-or-nothing kind of reset.
Since inserting is one entry only, the removal should also have the ability to be 1-based only as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants