spring-projects / spring-projects/spring-ai

Can't get complete content by Message:getText() in ChatMemory

Open
#3,134 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
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

  1. pom.xml
<dependency>
	<groupId>org.springframework.ai</groupId>
	<artifactId>spring-ai-starter-model-openai</artifactId>
</dependency>
  1. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.