agentscope-ai / agentscope-ai/agentscope-java

[Feature]: Offload base64 image data from AgentStateStore to reduce history retrieval overhead

未关闭
#2,852 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Java
星标
5.6k
派生
1.3k
平均合并
4 天 12 小时
30 天内合并 PR
77

描述

**Problem**
When `AgentStateStore` stores an `ImageBlock` that contains a base64-encoded image (transmitted in that format), it writes the full base64 string into `stateData`. This string is often very large, which significantly increases the time spent on retrieving or parsing historical messages.

**Solution**
Offload the base64-encoded image string to a new field or a separate table, and replace it with a placeholder in the original `ImageBlock`. Then, in the method that assembles historical messages for the model, add a step to restore the base64 data from the offloaded storage. This way, for routine history-reading operations, developers can choose not to query the base64 data.

**问题**
`AgentStateStore` 存储 base64 格式传输的图片消息 `ImageBlock` 时,会将图片的 base64 编码字符串存到 `stateData` 中,而这个字符串往往很大,这导致获取/解析历史消息的耗时显著变长。

**方案**
将图片的 base64 编码字符串卸载到一个新字段或者新表中,原 `ImageBlock` 中使用占位符替代,在模型组装历史消息的方法中增加还原 base64 编码的操作。这样一来,常规的历史消息读取处理时,开发者可以选择不查询 base64 编码信息。

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。