Replace InMemoryChatMemory with MessageWindowChatMemory

Proprietary

Spring AI 1.0 removed InMemoryChatMemory. This replaces new InMemoryChatMemory() with MessageWindowChatMemory.builder().build() and the remaining references to the type with MessageWindowChatMemory. Unlike InMemoryChatMemory, MessageWindowChatMemory keeps the last 20 messages of each conversation by default; set maxMessages(..) on the builder where more must be kept.

io.moderne.java.spring.ai1.MigrateInMemoryChatMemory
mod run . --recipe=io.moderne.java.spring.ai1.MigrateInMemoryChatMemory

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Change type InMemoryChatMemory to MessageWindowChatMemory