新增: ai_list_recoverable IPC+桌面可恢复入口双轨数据源(B3)

This commit is contained in:
lxy
2026-10-06 12:54:11 +08:00
parent 40392ebded
commit 7c252cff96
5 changed files with 56 additions and 5 deletions
+25 -4
View File
@@ -456,14 +456,31 @@ const runningTasks = computed(() => {
}
return items
})
// V49 可恢复入口(断点续跑读侧):conversations 中 loop_state='parked' 的会话(重启中断待续),
// 独立分区展示在任务面板下方,点击切回(继续与否由用户在会话内决定,不做自动续跑)
const recoverableTasks = computed(() => {
// V49 可恢复入口(B3):数据源双轨——conversations 中 loop_state='parked'(实时投影,
// 侧栏 limit 内)+ ai_list_recoverable 完备真相 IPC(面板展开时拉取,补侧栏截断漏项)。
// 合并去重按 id;点击切回,继续与否由用户在会话内决定,不做自动续跑
const recoverableFromList = computed(() => {
return store.state.conversations
.filter(c => c.loop_state === 'parked' && c.id !== store.state.activeConversationId)
.slice(0, 10)
.map(c => ({ id: c.id, title: c.title || t('aiChat.untitledConversation') }))
})
const recoverableFromIpc = ref<{ id: string; title: string | null }[]>([])
async function refreshRecoverable() {
try {
const items = await aiApi.listRecoverable()
recoverableFromIpc.value = items.map(i => ({ id: i.id, title: i.title }))
} catch { /* IPC 失败退回 list 投影,不阻断面板 */ }
}
const recoverableTasks = computed(() => {
const seen = new Set<string>()
const merged: { id: string; title: string }[] = []
for (const item of [...recoverableFromList.value, ...recoverableFromIpc.value]) {
if (item.id === store.state.activeConversationId || seen.has(item.id)) continue
seen.add(item.id)
merged.push({ id: item.id, title: item.title || t('aiChat.untitledConversation') })
}
return merged.slice(0, 10)
})
async function switchToRunning(id: string) {
runningTasksExpanded.value = false
if (id !== store.state.activeConversationId) {
@@ -593,6 +610,10 @@ function togglePanel(panel: 'goals' | 'history' | 'summary' | 'context' | 'runni
const willOpen = !refs[panel].value
goalsExpanded.value = historyExpanded.value = summaryExpanded.value = contextExpanded.value = runningTasksExpanded.value = false
refs[panel].value = willOpen
// B3:任务面板展开时拉一次可恢复清单完备真相(补侧栏 limit 截断漏项);失败退回 list 投影
if (panel === 'running' && willOpen) {
void refreshRecoverable()
}
}
const contextInfo = computed<ContextInfo>(() => {