AS AgentScopeAPI 手册 / API Reference

DemoThreadStore

@Component public final class DemoThreadStore
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:46–268

Demo 会话线程存储,负责持久化与读取数据。位于 io.agentscope.examples.copilotkit.service 包。核心成员包括 list、create、update、archive、delete、events。

CopilotKit thread APIs backed by ThreadSessionManager sessions.

字段摘要Field Summary

字段Field类型Type说明Description
DEFAULT_AGENT_ID
staticfinal
String
默认智能体标识字段。
The DEFAULT AGENT ID field.
DEMO_USER_ID
staticfinal
String
DEMO 用户标识字段。
Demo identity; matches `AgentConfiguration` when `X-Token` is absent.

构造器摘要Constructor Summary

构造器Constructor说明Description
public DemoThreadStore(ThreadSessionManager sessionManager, AguiAgentRegistry agentRegistry, InMemoryAgentEventStore eventStore, AgentEventAguiReplayer eventReplayer)
初始化 `DemoThreadStore` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public ThreadsResponse list(String agentId, boolean includeArchived, Integer limit, String cursor)
执行列表相关操作。
Performs the list operation.
public ThreadInfo create(ThreadMutationRequest request)
创建并返回实例。
Creates and returns an instance.
public ThreadInfo update(String threadId, ThreadMutationRequest request)
执行更新相关操作。
Performs the update operation.
public ThreadInfo archive(String threadId, ThreadMutationRequest request)
执行归档相关操作。
Performs the archive operation.
public Map<String, Object> delete(String threadId)
删除数据。
Performs the delete operation.
public Map<String, Object> events(String threadId)
设置事件。
Performs the events operation.
public Map<String, Object> messages(String threadId)
设置消息。
Performs the messages operation.
public Map<String, Object> state(String threadId)
设置状态。
Performs the state operation.

字段详情Field Detail

DEFAULT_AGENT_ID

public static final String DEFAULT_AGENT_ID
staticfinal

默认智能体标识字段。声明为 public static final String DEFAULT_AGENT_ID。

The DEFAULT AGENT ID field.

源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:49

DEMO_USER_ID

public static final String DEMO_USER_ID
staticfinal

DEMO 用户标识字段。声明为 public static final String DEMO_USER_ID。

Demo identity; matches AgentConfiguration when X-Token is absent.

源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:52

构造器详情Constructor Detail

DemoThreadStore

public DemoThreadStore(ThreadSessionManager sessionManager, AguiAgentRegistry agentRegistry, InMemoryAgentEventStore eventStore, AgentEventAguiReplayer eventReplayer)

初始化 DemoThreadStore 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
sessionManagerThreadSessionManager会话管理器(类型 `ThreadSessionManager`)。The session manager.
agentRegistryAguiAgentRegistry智能体注册表(类型 `AguiAgentRegistry`)。The agent registry.
eventStoreInMemoryAgentEventStore事件存储(类型 `InMemoryAgentEventStore`)。The event store.
eventReplayerAgentEventAguiReplayer事件 Replayer(类型 `AgentEventAguiReplayer`)。The event replayer.
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:62–71

方法详情Method Detail

list

public ThreadsResponse list(String agentId, boolean includeArchived, Integer limit, String cursor)

执行列表相关操作。

Performs the list operation.

参数Parameters
名称Name类型Type说明Description
agentIdString智能体标识(类型 `String`)。The agent id.
includeArchivedbooleaninclude Archived(类型 `boolean`)。The include archived.
limitInteger数量上限(类型 `Integer`)。The limit.
cursorString游标(类型 `String`)。The cursor.
返回Returns ThreadsResponse
返回ThreadsResponse。Returns threads response.
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:73–94

create

public ThreadInfo create(ThreadMutationRequest request)

创建并返回实例。

Creates and returns an instance.

参数Parameters
名称Name类型Type说明Description
requestThreadMutationRequest请求(类型 `ThreadMutationRequest`)。The request.
返回Returns ThreadInfo
返回ThreadInfo。Returns thread info.
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:96–104

update

public ThreadInfo update(String threadId, ThreadMutationRequest request)

执行更新相关操作。

Performs the update operation.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。The thread id.
requestThreadMutationRequest请求(类型 `ThreadMutationRequest`)。The request.
返回Returns ThreadInfo
返回ThreadInfo。Returns thread info.
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:106–115

archive

public ThreadInfo archive(String threadId, ThreadMutationRequest request)

执行归档相关操作。

Performs the archive operation.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。The thread id.
requestThreadMutationRequest请求(类型 `ThreadMutationRequest`)。The request.
返回Returns ThreadInfo
返回ThreadInfo。Returns thread info.
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:117–122

delete

public Map<String, Object> delete(String threadId)

删除数据。

Performs the delete operation.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。The thread id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:124–128

events

public Map<String, Object> events(String threadId)

设置事件。

Performs the events operation.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。The thread id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:130–138

messages

public Map<String, Object> messages(String threadId)

设置消息。

Performs the messages operation.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。The thread id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:140–153

state

public Map<String, Object> state(String threadId)

设置状态。

Performs the state operation.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。The thread id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/examples/copilotkit/service/DemoThreadStore.java:155–173
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.