Add chat-memory module: MessageWindowChatMemory, JDBC and Redis repositories, per-user conversation IDs
Real PostgreSQL 16 and Redis Stack 7.4; 24 tests write output/01-24. Covers the 20-message default window with no property, the 36-character conversation_id, tool messages dropped by JdbcChatMemoryRepository, concurrent add() on one conversation, a 1.x table under the 2.0 repository, the Redis repository silently backing off for a custom ChatMemory, and the removal of PromptChatMemoryAdvisor. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ja4jkzrbQ4LQZBNrb5mkZE
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: ${CM_PG_URL:jdbc:postgresql://127.0.0.1:5440/chatdb}
|
||||
username: chat
|
||||
password: chat
|
||||
ai:
|
||||
chat:
|
||||
memory:
|
||||
repository:
|
||||
jdbc:
|
||||
initialize-schema: always
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- org.springframework.ai.model.chat.memory.repository.redis.autoconfigure.RedisChatMemoryRepositoryAutoConfiguration
|
||||
@@ -0,0 +1,14 @@
|
||||
spring:
|
||||
ai:
|
||||
chat:
|
||||
memory:
|
||||
repository:
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: ${CM_REDIS_STACK_PORT:6390}
|
||||
time-to-live: 24h
|
||||
max-messages-per-conversation: 200
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration
|
||||
- org.springframework.ai.model.chat.memory.repository.jdbc.autoconfigure.JdbcChatMemoryRepositoryAutoConfiguration
|
||||
@@ -0,0 +1,25 @@
|
||||
spring:
|
||||
application:
|
||||
name: chat-memory
|
||||
ai:
|
||||
model:
|
||||
chat: openai
|
||||
openai:
|
||||
api-key: ${OPENAI_API_KEY:sk-not-set}
|
||||
chat:
|
||||
model: gpt-5-mini
|
||||
# Default profile = the in-memory repository. Spring AI's JDBC and Redis repository
|
||||
# autoconfigurations are on the classpath (both starters are dependencies) and would otherwise
|
||||
# demand a DataSource / a Redis server at startup, so they are excluded here and re-enabled per
|
||||
# profile in application-jdbc.yml and application-redis.yml.
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration
|
||||
- org.springframework.ai.model.chat.memory.repository.jdbc.autoconfigure.JdbcChatMemoryRepositoryAutoConfiguration
|
||||
- org.springframework.ai.model.chat.memory.repository.redis.autoconfigure.RedisChatMemoryRepositoryAutoConfiguration
|
||||
|
||||
app:
|
||||
memory:
|
||||
max-messages: 20
|
||||
ownership:
|
||||
enforce: true
|
||||
Reference in New Issue
Block a user