类 StateBackedMemory
java.lang.Object
io.agentscope.core.memory.StateBackedMemory
- 所有已实现的接口:
Memory
@Deprecated(forRemoval=true,
since="2.0.0")
public class StateBackedMemory
extends Object
implements Memory
已过时, 待删除: 此 API 元素将从以后的版本中删除。
A
Memory implementation that delegates all reads and writes to
AgentState.contextMutable().
This adapter exists solely to preserve backward compatibility for code that
accesses conversation history via agent.getMemory().getMessages().
The canonical location of conversation context in 2.0 is
AgentState.getContext().
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddMessage(Msg message) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Adds a message to the memory.voidclear()已过时, 待删除: 此 API 元素将从以后的版本中删除。Clears all messages from memory.voiddeleteMessage(int index) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Deletes a message at the specified index.已过时, 待删除: 此 API 元素将从以后的版本中删除。Retrieves all messages stored in memory.voidloadFrom(AgentStateStore stateStore, String userId, String sessionId) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Load a previously saved message buffer (no-op when none exists).voidsaveTo(AgentStateStore stateStore, String userId, String sessionId) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Save the message buffer under thememory_messagessession key.
-
构造器详细资料
-
StateBackedMemory
已过时, 待删除: 此 API 元素将从以后的版本中删除。
-
-
方法详细资料
-
addMessage
已过时, 待删除: 此 API 元素将从以后的版本中删除。从接口复制的说明:MemoryAdds a message to the memory.- 指定者:
addMessage在接口中Memory- 参数:
message- The message to store in memory
-
getMessages
已过时, 待删除: 此 API 元素将从以后的版本中删除。从接口复制的说明:MemoryRetrieves all messages stored in memory.- 指定者:
getMessages在接口中Memory- 返回:
- A list of all messages (may be empty but never null)
-
deleteMessage
public void deleteMessage(int index) 已过时, 待删除: 此 API 元素将从以后的版本中删除。从接口复制的说明:MemoryDeletes a message at the specified index.If the index is out of bounds (negative or >= size), this operation should be a no-op rather than throwing an exception. This provides safe cleanup even with concurrent modifications.
- 指定者:
deleteMessage在接口中Memory- 参数:
index- The index of the message to delete (0-based)
-
clear
public void clear()已过时, 待删除: 此 API 元素将从以后的版本中删除。从接口复制的说明:MemoryClears all messages from memory.This operation removes all stored conversation history. Use with caution as this action is typically irreversible unless state has been persisted.
-
saveTo
已过时, 待删除: 此 API 元素将从以后的版本中删除。从接口复制的说明:MemorySave the message buffer under thememory_messagessession key. -
loadFrom
已过时, 待删除: 此 API 元素将从以后的版本中删除。从接口复制的说明:MemoryLoad a previously saved message buffer (no-op when none exists).
-
AgentState.getContext()directly.