Skip to content

Commit

Permalink
Be more defensive when removing chat memory ids
Browse files Browse the repository at this point in the history
Fixes: #401
(cherry picked from commit 200bbdc)
  • Loading branch information
geoand committed Mar 27, 2024
1 parent 3bd3a16 commit 69a9633
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public void accept(Object memoryId, ChatMemory chatMemory) {
* via {@link io.quarkiverse.langchain4j.ChatMemoryRemover}
*/
public void removeChatMemoryIds(Object... ids) {
if (chatMemories == null) {
return;
}
for (Object id : ids) {
ChatMemory chatMemory = chatMemories.remove(id);
if (chatMemory != null) {
Expand Down

0 comments on commit 69a9633

Please sign in to comment.