Agent Activity

将持续变化的助手活动组织为可展开步骤与完成摘要。

适用场景

  • 当界面需要以下行为时使用 Agent Activity:将持续变化的助手活动组织为可展开步骤与完成摘要。

安装

选择安装方式,用法示例将同步更新导入路径。

$ bunx --bun shadcn-vue@2.8.2 add https://orvui.efu.me/r/agent-activity.json

首次使用时,将安装的 src/components/orvui/styles.css 导入项目样式入口。

示例

Streaming Text

streaming-text.vue

随内容到达追加活动文字,并在分组中保留已完成步骤。

Thinking…

Reasoning Steps

reasoning-steps.vue

将推理序列展示为独立步骤,并可折叠为摘要。

Thinking…
Reading the product brief

Tool Calls

tool-calls.vue

跟踪工具调用,并展示等待与完成状态。

Running tools…

Mixed Activity

mixed-activity.vue

把推理、搜索、消息和工具组合为同一变化中的活动分组。

Thinking…
Reading the launch brief

Agent Trace

agent-trace.vue

汇总工具调用数和消息数,同时保留各个独立步骤。

Running the agent trace…

组合结构

使用公开部件 AgentActivity 组合 Agent Activity,并从该组件的公开入口导入。

Message
└── MessageContent
    └── AgentActivity

说明: Agent Loading States 通过进度、推理和微光显示传达助手工作仍在进行。 Todo List 展示带展开详情和明确任务状态的工作条目序列。 Tool Result 在同一表面呈现工具调用状态、摘要与可展开结果。

工作方式

将持续变化的助手活动组织为可展开步骤与完成摘要。

状态与事件

需要由表单、路由或父组件管理时,绑定下列状态并接收对应更新。v-model 是属性与 update 事件的简写;值的类型应与 API 一致。

组件状态绑定
组件Vue 绑定更新事件
AgentActivityv-model:openbooleanupdate:open

可选受控属性未传入时,按组件文档的默认行为工作;不要用固定的 false 或空值代替未传入。异步请求和持久化在应用中处理,再把结果传回组件。

API 参考

Streaming Text

items
AgentActivityItem[]
—
contentType?
"step" | "text" | "search" | "tool" | "trace" | "mixed"
—
status?
"complete" | "working"
"working"
duration?
number
0
open?
boolean
undefined
defaultOpen?
boolean
false
collapseOnComplete?
boolean
true
activeLabel?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
summary?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
maxHeight?
number
208
contentClassName?
string
—

事件

update:open
[open: boolean]
@update:open
openChange
[open: boolean]
@openChange

插槽

working-status
(context: { label: Content; duration: number; }) => VNodeChild

作用域参数: label, duration

#working-status
completed-status
(context: { summary: Content; duration: number; }) => VNodeChild

作用域参数: summary, duration

#completed-status

Reasoning Steps

items
AgentActivityItem[]
—
contentType?
"step" | "text" | "search" | "tool" | "trace" | "mixed"
—
status?
"complete" | "working"
"working"
duration?
number
0
open?
boolean
undefined
defaultOpen?
boolean
false
collapseOnComplete?
boolean
true
activeLabel?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
summary?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
maxHeight?
number
208
contentClassName?
string
—

事件

update:open
[open: boolean]
@update:open
openChange
[open: boolean]
@openChange

插槽

working-status
(context: { label: Content; duration: number; }) => VNodeChild

作用域参数: label, duration

#working-status
completed-status
(context: { summary: Content; duration: number; }) => VNodeChild

作用域参数: summary, duration

#completed-status

Web Search

items
AgentActivityItem[]
—
contentType?
"step" | "text" | "search" | "tool" | "trace" | "mixed"
—
status?
"complete" | "working"
"working"
duration?
number
0
open?
boolean
undefined
defaultOpen?
boolean
false
collapseOnComplete?
boolean
true
activeLabel?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
summary?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
maxHeight?
number
208
contentClassName?
string
—

事件

update:open
[open: boolean]
@update:open
openChange
[open: boolean]
@openChange

插槽

working-status
(context: { label: Content; duration: number; }) => VNodeChild

作用域参数: label, duration

#working-status
completed-status
(context: { summary: Content; duration: number; }) => VNodeChild

作用域参数: summary, duration

#completed-status

Tool Calls

items
AgentActivityItem[]
—
contentType?
"step" | "text" | "search" | "tool" | "trace" | "mixed"
—
status?
"complete" | "working"
"working"
duration?
number
0
open?
boolean
undefined
defaultOpen?
boolean
false
collapseOnComplete?
boolean
true
activeLabel?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
summary?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
maxHeight?
number
208
contentClassName?
string
—

事件

update:open
[open: boolean]
@update:open
openChange
[open: boolean]
@openChange

插槽

working-status
(context: { label: Content; duration: number; }) => VNodeChild

作用域参数: label, duration

#working-status
completed-status
(context: { summary: Content; duration: number; }) => VNodeChild

作用域参数: summary, duration

#completed-status

Mixed Activity

items
AgentActivityItem[]
—
contentType?
"step" | "text" | "search" | "tool" | "trace" | "mixed"
—
status?
"complete" | "working"
"working"
duration?
number
0
open?
boolean
undefined
defaultOpen?
boolean
false
collapseOnComplete?
boolean
true
activeLabel?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
summary?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
maxHeight?
number
208
contentClassName?
string
—

事件

update:open
[open: boolean]
@update:open
openChange
[open: boolean]
@openChange

插槽

working-status
(context: { label: Content; duration: number; }) => VNodeChild

作用域参数: label, duration

#working-status
completed-status
(context: { summary: Content; duration: number; }) => VNodeChild

作用域参数: summary, duration

#completed-status

Agent Trace

items
AgentActivityItem[]
—
contentType?
"step" | "text" | "search" | "tool" | "trace" | "mixed"
—
status?
"complete" | "working"
"working"
duration?
number
0
open?
boolean
undefined
defaultOpen?
boolean
false
collapseOnComplete?
boolean
true
activeLabel?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
summary?
boolean | null | string | number | void | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNodeArrayChildren | ComponentOptions<any, any, any, ComputedOptions, MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions> | FunctionalComponent<any, {}, any, {}> | ComponentPublicInstanceConstructor<any, any, any, any, ComputedOptions, MethodOptions>
undefined
maxHeight?
number
208
contentClassName?
string
—

事件

update:open
[open: boolean]
@update:open
openChange
[open: boolean]
@openChange

插槽

working-status
(context: { label: Content; duration: number; }) => VNodeChild

作用域参数: label, duration

#working-status
completed-status
(context: { summary: Content; duration: number; }) => VNodeChild

作用域参数: summary, duration

#completed-status

无障碍

为交互控件提供明确的无障碍名称。保留文档中的键盘路径、可见焦点与减少动态效果状态;自定义插槽应继续保留所替代部件的语义。

常见问题

如何配置 Agent Activity?
通过 items、contentType、status、duration、open、defaultOpen、collapseOnComplete、activeLabel、summary、maxHeight、contentClassName 配置 Agent Activity;API 表列出其类型与默认值。
如何连接到应用状态?
监听 update:open、openChange,将组件连接到应用状态。
可以在服务端渲染吗?
可以在 Vue SSR 应用中正常渲染。服务端与客户端的初始 props 应保持一致;浏览器测量与交互资源在挂载后启动。

更新于