包package
agentscope.tuiagentscope.tui
module agentscope.tui
agentscope.tui 属于基础设施,类型、异常、传输与工具函数。 该包共收录 4 个公开类型。
Interactive terminal UI components for AgentScope.
源码Source
agentscope/tui/__init__.py:1类Classes
ChatUI类class | 聊天 UI,为框架提供通用类型与基础能力。 Messages, composer and HITL controls without an Agent dependency. |
MessagesUI类class | 消息 UI,为框架提供通用类型与基础能力。 Render authoritative message snapshots without consuming events. |
函数Functions
launch_realtime_ui函数function | 启动实时语音界面 Launch a full-screen terminal view of a voice session. |
launch_tui函数function | 启动全屏终端对话 Launch a full-screen interactive terminal chat. |
函数详情Function Details
launch_realtime_ui
async def launch_realtime_ui(agent: RealtimeAgent, transport: TransportBase, *, messages: Sequence[Msg] = (), user_name: str = 'user') -> None
async
启动全屏终端界面展示实时语音会话状态与转写结果。
Both the agent and the transport are borrowed: they must already be started, and neither is closed here.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | RealtimeAgent | 智能体(类型 `RealtimeAgent`)。A connected realtime agent. Its `reply_stream` runs for the whole session, while a confirmation, an interrupt or a typed turn goes back in through `send`. |
transport | TransportBase | 传输层(类型 `TransportBase`)。The started transport carrying the audio. It plays the reply itself, so the view shows the transcripts only. |
messageskw默认default () | Sequence[Msg] | 消息列表(类型 `Sequence[Msg]`)。Historical messages displayed before live interaction starts. |
user_namekw默认default 'user' | str | 用户名称(类型 `str`)。Name assigned to messages submitted from the composer, which is disabled for a model that takes no text input. |
None
无返回值。No value is returned.
源码Source
agentscope/tui/_launcher.py:329–355launch_tui
async def launch_tui(target: Agent | PipelineProtocol, *, messages: Sequence[Msg] = (), user_name: str = 'user') -> None
async
启动全屏交互式终端对话界面,适合本地体验与演示。
Launch a full-screen interactive terminal chat.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
target | Agent | PipelineProtocol | 目标(类型 `Agent | PipelineProtocol`)。Agent or pipeline whose `reply_stream` consumes user messages and HITL continuation events. |
messageskw默认default () | Sequence[Msg] | 消息列表(类型 `Sequence[Msg]`)。Historical messages displayed before live interaction starts. |
user_namekw默认default 'user' | str | 用户名称(类型 `str`)。Name assigned to messages submitted from the composer. |
None
无返回值。No value is returned.
源码Source
agentscope/tui/_launcher.py:309–326