DemoThreadStore
@Component public final class DemoThreadStore
源码Source
io/agentscope/examples/copilotkit/service/DemoThreadStore.java:46–268Demo 会话线程存储,负责持久化与读取数据。位于 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_IDstaticfinal | String | 默认智能体标识字段。 The DEFAULT AGENT ID field. |
DEMO_USER_IDstaticfinal | String | DEMO 用户标识字段。 Demo identity; matches `AgentConfiguration` when `X-Token` is absent. |
构造器摘要Constructor Summary
方法摘要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:49DEMO_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 |
|---|---|---|
sessionManager | ThreadSessionManager | 会话管理器(类型 `ThreadSessionManager`)。The session manager. |
agentRegistry | AguiAgentRegistry | 智能体注册表(类型 `AguiAgentRegistry`)。The agent registry. |
eventStore | InMemoryAgentEventStore | 事件存储(类型 `InMemoryAgentEventStore`)。The event store. |
eventReplayer | AgentEventAguiReplayer | 事件 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 |
|---|---|---|
agentId | String | 智能体标识(类型 `String`)。The agent id. |
includeArchived | boolean | include Archived(类型 `boolean`)。The include archived. |
limit | Integer | 数量上限(类型 `Integer`)。The limit. |
cursor | String | 游标(类型 `String`)。The cursor. |
ThreadsResponse返回ThreadsResponse。Returns threads response.
源码Source
io/agentscope/examples/copilotkit/service/DemoThreadStore.java:73–94create
public ThreadInfo create(ThreadMutationRequest request)
创建并返回实例。
Creates and returns an instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
request | ThreadMutationRequest | 请求(类型 `ThreadMutationRequest`)。The request. |
ThreadInfo返回ThreadInfo。Returns thread info.
源码Source
io/agentscope/examples/copilotkit/service/DemoThreadStore.java:96–104update
public ThreadInfo update(String threadId, ThreadMutationRequest request)
执行更新相关操作。
Performs the update operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
request | ThreadMutationRequest | 请求(类型 `ThreadMutationRequest`)。The request. |
ThreadInfo返回ThreadInfo。Returns thread info.
源码Source
io/agentscope/examples/copilotkit/service/DemoThreadStore.java:106–115archive
public ThreadInfo archive(String threadId, ThreadMutationRequest request)
执行归档相关操作。
Performs the archive operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
request | ThreadMutationRequest | 请求(类型 `ThreadMutationRequest`)。The request. |
ThreadInfo返回ThreadInfo。Returns thread info.
源码Source
io/agentscope/examples/copilotkit/service/DemoThreadStore.java:117–122delete
public Map<String, Object> delete(String threadId)
删除数据。
Performs the delete operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
Map<String, Object>返回映射。Returns map.
源码Source
io/agentscope/examples/copilotkit/service/DemoThreadStore.java:124–128events
public Map<String, Object> events(String threadId)
设置事件。
Performs the events operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
Map<String, Object>返回映射。Returns map.
源码Source
io/agentscope/examples/copilotkit/service/DemoThreadStore.java:130–138messages
public Map<String, Object> messages(String threadId)
设置消息。
Performs the messages operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
Map<String, Object>返回映射。Returns map.
源码Source
io/agentscope/examples/copilotkit/service/DemoThreadStore.java:140–153state
public Map<String, Object> state(String threadId)
设置状态。
Performs the state operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
Map<String, Object>返回映射。Returns map.
源码Source
io/agentscope/examples/copilotkit/service/DemoThreadStore.java:155–173