feat:通知主题修改
This commit is contained in:
@@ -133,6 +133,14 @@ export function useNotification() {
|
||||
}
|
||||
}
|
||||
|
||||
// 更新通知的主标题
|
||||
const updateNotificationTitle = (id: string, title: string) => {
|
||||
const notification = notifications.value.find((n) => n.id === id)
|
||||
if (notification) {
|
||||
notification.title = title
|
||||
}
|
||||
}
|
||||
|
||||
const clear = () => {
|
||||
notifications.value.forEach((n) => n.onClose?.())
|
||||
notifications.value = []
|
||||
@@ -149,6 +157,7 @@ export function useNotification() {
|
||||
progress,
|
||||
updateProgress,
|
||||
updateProgressDetail,
|
||||
updateNotificationTitle,
|
||||
clear,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,12 +358,25 @@ const {
|
||||
notifications,
|
||||
progress: showProgress,
|
||||
updateProgressDetail,
|
||||
updateNotificationTitle,
|
||||
success,
|
||||
info,
|
||||
warning,
|
||||
error
|
||||
} = useNotification()
|
||||
const currentProgressNotificationId = ref<string | null>(null)
|
||||
const currentProgressTitle = ref('任务执行中') // 🆕 追踪当前进度通知的标题
|
||||
|
||||
/**
|
||||
* 更新进度通知的标题
|
||||
*/
|
||||
function updateProgressNotificationTitle(title: string) {
|
||||
currentProgressTitle.value = title
|
||||
if (currentProgressNotificationId.value) {
|
||||
// 直接更新通知的主标题
|
||||
updateNotificationTitle(currentProgressNotificationId.value, title)
|
||||
}
|
||||
}
|
||||
|
||||
// Pause functionality state
|
||||
const isPaused = ref(false)
|
||||
@@ -484,10 +497,13 @@ async function executeNextReadyBatch() {
|
||||
currentStepName: event.step_name
|
||||
}
|
||||
|
||||
// 创建或更新进度通知,显示详细步骤信息
|
||||
// 🆕 创建或更新进度通知,显示详细步骤信息(根据状态显示不同标题)
|
||||
const currentTitle = isPausing.value ? '暂停中' : '任务执行中'
|
||||
updateProgressNotificationTitle(currentTitle)
|
||||
|
||||
if (!currentProgressNotificationId.value) {
|
||||
currentProgressNotificationId.value = showProgress(
|
||||
'任务执行中',
|
||||
currentTitle,
|
||||
executionProgress.value.currentStep,
|
||||
executionProgress.value.totalSteps
|
||||
)
|
||||
@@ -533,7 +549,10 @@ async function executeNextReadyBatch() {
|
||||
// 当前动作完成,完成暂停
|
||||
isPaused.value = true
|
||||
isPausing.value = false
|
||||
success('已暂停', '已暂停执行,可稍后继续')
|
||||
// 🆕 更新进度通知标题为"已暂停..."
|
||||
updateProgressNotificationTitle('已暂停')
|
||||
// 只显示简短的成功提示,不覆盖进度通知
|
||||
console.log('✅ 已暂停执行')
|
||||
}
|
||||
|
||||
// 更新详细进度信息,显示动作级别进度
|
||||
@@ -603,11 +622,13 @@ async function executeNextReadyBatch() {
|
||||
}
|
||||
})
|
||||
|
||||
// 关闭进度通知并显示完成通知
|
||||
// 🆕 关闭进度通知并显示完成通知
|
||||
if (currentProgressNotificationId.value) {
|
||||
removeNotification(currentProgressNotificationId.value)
|
||||
currentProgressNotificationId.value = null
|
||||
}
|
||||
// 重置标题
|
||||
currentProgressTitle.value = '任务执行中'
|
||||
|
||||
success('任务执行完成', `所有步骤已执行完成`, { duration: 3000 })
|
||||
resolve()
|
||||
@@ -759,6 +780,8 @@ async function handlePauseResume() {
|
||||
// 只有在收到成功响应后才更新状态
|
||||
isPaused.value = false
|
||||
isPausing.value = false
|
||||
// 🆕 恢复执行时更新进度通知标题
|
||||
updateProgressNotificationTitle('任务执行中')
|
||||
success('已恢复', '已恢复执行')
|
||||
} else {
|
||||
warning('无法恢复', 'WebSocket未连接,无法恢复执行')
|
||||
@@ -773,7 +796,7 @@ async function handlePauseResume() {
|
||||
if (websocket.connected) {
|
||||
// 先设置 isPausing,允许接收当前正在执行的动作的结果
|
||||
isPausing.value = true
|
||||
info('暂停中', '正在等待当前动作完成...')
|
||||
info('暂停中', '正在等待当前动作完成')
|
||||
|
||||
await websocket.send('pause_execution', {
|
||||
goal: agentsStore.agentRawPlan.data?.['General Goal'] || ''
|
||||
@@ -967,10 +990,13 @@ async function restartFromStep(stepIndex: number) {
|
||||
const currentStepNumber =
|
||||
globalStepIndex >= 0 ? globalStepIndex + 1 : (event.step_index || 0) + 1
|
||||
|
||||
// 创建或更新进度通知
|
||||
// 🆕 创建或更新进度通知(根据状态显示不同标题)
|
||||
const restartTitle = isPausing.value ? '暂停中' : '重新执行中'
|
||||
updateProgressNotificationTitle(restartTitle)
|
||||
|
||||
if (!currentProgressNotificationId.value) {
|
||||
currentProgressNotificationId.value = showProgress(
|
||||
'重新执行中',
|
||||
restartTitle,
|
||||
currentStepNumber,
|
||||
collaborationProcess.value.length
|
||||
)
|
||||
@@ -996,7 +1022,9 @@ async function restartFromStep(stepIndex: number) {
|
||||
// 当前动作完成,完成暂停
|
||||
isPaused.value = true
|
||||
isPausing.value = false
|
||||
success('已暂停', '已暂停执行,可稍后继续')
|
||||
// 🆕 更新进度通知标题为"已暂停..."
|
||||
updateProgressNotificationTitle('已暂停')
|
||||
console.log('✅ 已暂停执行')
|
||||
}
|
||||
|
||||
// 实时更新store
|
||||
@@ -1196,6 +1224,10 @@ async function handleRun() {
|
||||
// Reset pause and streaming state
|
||||
isPaused.value = false
|
||||
isStreaming.value = false
|
||||
isPausing.value = false
|
||||
|
||||
// 🆕 重置进度通知标题
|
||||
currentProgressTitle.value = '任务执行中'
|
||||
|
||||
// Start execution
|
||||
loading.value = true
|
||||
|
||||
Reference in New Issue
Block a user