Files
DPM/src/utils/statusBus.js
T
Pine 107727ea5e feat: Refactor DpmOverlays to use ShowCard for rendering cards and add ToolStatusToast for operation status notifications
- Moved card rendering logic from DpmOverlays to a new ShowCard component for better reusability.
- Introduced ToolStatusToast to display real-time operation statuses in the top right corner.
- Updated PageHeader to conditionally render credits based on the current path.
- Modified PromptPanel to change tool names and update prompt titles.
- Enhanced ScreenLayout to include ToolStatusToast.
- Updated styles for new components and adjusted existing styles for consistency.
- Implemented statusBus utility for dispatching tool status events.
- Updated useMqttControl to integrate tool status notifications during navigation and card display actions.
2026-08-19 12:28:35 +08:00

13 lines
728 B
JavaScript

/* =========================================================
工具 / 操作进行中状态提示总线
统一 dispatch `dpm:tool-status` 事件,由 ToolStatusToast 监听显示在右上角。
用法:
aiStatus('正在检索知识库') // 进行中(带转圈)
aiStatus('正在调用工具:切换页面', { icon: 'tool' })
aiStatus('操作完成', { state: 'done', icon: 'check' }) // 完成态
aiStatus('出错了', { state: 'error', icon: 'error' })
========================================================= */
export function aiStatus(text, opts = {}) {
window.dispatchEvent(new CustomEvent('dpm:tool-status', { detail: { text, ...opts } }));
}