Skip to content

fix: modify the message storage format of chat_message#448

Closed
AutumnFruit-1999 wants to merge 30 commits intospring-ai-alibaba:mainfrom
AutumnFruit-1999:main
Closed

fix: modify the message storage format of chat_message#448
AutumnFruit-1999 wants to merge 30 commits intospring-ai-alibaba:mainfrom
AutumnFruit-1999:main

Conversation

@AutumnFruit-1999
Copy link
Copy Markdown
Contributor

Describe what this PR does / why we need it

消息存储格式是基于前端构建的html格式消息,要求存储原始文本

Does this pull request fix one issue?

Describe how you did it

基于通过获取graph历史状态获取

  1. 因为state返回的是keyStrategyHashMap的键值对,在流式返回中添加节点和对应节点名称
  2. 在调用回话存储接口,增加参数threadId和keyStrategyHashMap中对应键值对key
  3. 在调用过程中先通过threadId获取state,在根据key获取状态中的信息
  4. 为了不影响页面展示,表中新增字段用来保存原始原始对话
    问题:
    框架中节点拼接的消息不会增加的graph状态中,只会添加llm返回信息,导致展示和存储的消息不符
image image

现解决方法
流式数据发送到前端的时候是原始的文本数据,在前端进行html的拼接之后调用消息保存接口,即将原始的未进行html格式的数据直接请求到后端,保证输出消息和存储的原始消息保持一致

Describe how to verify it

Special notes for reviews

@AutumnFruit-1999 AutumnFruit-1999 changed the title Modify the message storage format of chat_message fix:Modify the message storage format of chat_message Feb 26, 2026
@AutumnFruit-1999 AutumnFruit-1999 changed the title fix:Modify the message storage format of chat_message fix: modify the message storage format of chat_message Feb 26, 2026
@zxuexingzhijie
Copy link
Copy Markdown
Collaborator

zxuexingzhijie commented Feb 26, 2026

Unknown column 'content_html' in 'field list,看一下,再修复下ci

Copy link
Copy Markdown
Collaborator

@zxuexingzhijie zxuexingzhijie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@AutumnFruit-1999
Copy link
Copy Markdown
Contributor Author

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants