类 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 元素将从以后的版本中删除。
since 2.0.0. Use AgentState.getContext() directly.
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().

  • 构造器概要

    构造器
    构造器
    说明
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
     
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    addMessage(Msg message)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Adds a message to the memory.
    void
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Clears all messages from memory.
    void
    deleteMessage(int index)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Deletes a message at the specified index.
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Retrieves all messages stored in memory.
    void
    loadFrom(AgentStateStore stateStore, String userId, String sessionId)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Load a previously saved message buffer (no-op when none exists).
    void
    saveTo(AgentStateStore stateStore, String userId, String sessionId)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Save the message buffer under the memory_messages session key.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • StateBackedMemory

      public StateBackedMemory(AgentState state)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
  • 方法详细资料

    • addMessage

      public void addMessage(Msg message)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Adds a message to the memory.
      指定者:
      addMessage 在接口中 Memory
      参数:
      message - The message to store in memory
    • getMessages

      public List<Msg> getMessages()
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Retrieves 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 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Deletes 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 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Clears 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.

      指定者:
      clear 在接口中 Memory
    • saveTo

      public void saveTo(AgentStateStore stateStore, String userId, String sessionId)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Save the message buffer under the memory_messages session key.
      指定者:
      saveTo 在接口中 Memory
    • loadFrom

      public void loadFrom(AgentStateStore stateStore, String userId, String sessionId)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Load a previously saved message buffer (no-op when none exists).
      指定者:
      loadFrom 在接口中 Memory