spring-projects / spring-projects/spring-ai
Can't get complete content by Message:getText() in ChatMemory
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Bug description
Can't get complete content by Message:getText() in ChatMemory.
Environment
1.0.0-SNAPSHOT(1.0.0-20250512.234548-238)
Steps to reproduce
Call streaming API(OpenApiChatModel).
Expected behavior
Store the answer content.
Minimal Complete Reproducible example
- pom.xml
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-model-openai</artifactId>
</dependency>
- code
chatClient.prompt()
.user(userInput).advisors(MessageChatMemoryAdvisor.builder(chatService).protectFromBlocking(true).build()).advisors(advisorSpec -> advisorSpec.param(ChatMemory.CONVERSATION_ID, conversationId))
.stream().chatResponse();
The chatService is used for storing content.
Run, and I have identified an issue, the ChatMemory.add(String conversationId, List messages) parameter in Message:getText has no content.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the OpenApiChatModel streaming path, MessageChatMemoryAdvisor, and ChatMemory.add(String conversationId, List messages), using the supplied pom.xml and streaming example to reproduce the problem. Done means the stored Message.getText() contains the complete streamed answer rather than empty content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100