fix: preserve channel message delivery

This commit is contained in:
lofyer
2026-08-13 02:09:09 +08:00
parent 67cb69f07d
commit 980f3a0c8f
15 changed files with 586 additions and 130 deletions
+26 -26
View File
@@ -1571,30 +1571,30 @@ export function registerIpcHandlers(
contextManager.remove(contextId)
}
}
const remoteConversation =
assistantDatabase.getOrCreateRemoteConversation({
projectId: project.id,
channel,
accountId: 'default',
externalConversationId: message.conversationId,
conversationType: message.conversationType,
title: `${channelLabel} · ****${identitySuffix}`,
accountDisplay: senderDisplay,
runtimeSelection
try {
const remoteConversation =
assistantDatabase.getOrCreateRemoteConversation({
projectId: project.id,
channel,
accountId: message.accountId,
externalConversationId: message.conversationId,
conversationType: message.conversationType,
title: `${channelLabel} · ****${identitySuffix}`,
accountDisplay: senderDisplay,
runtimeSelection
})
assistantDatabase.appendRemoteConversationMessage({
conversationId: remoteConversation.id,
role: 'user',
content: parsed.prompt,
attachments: publicAttachments,
status: `${channelLabel} · ${
parsed.workMode === 'execute'
? '执行'
: '对话'
}`
})
assistantDatabase.appendRemoteConversationMessage({
conversationId: remoteConversation.id,
role: 'user',
content: parsed.prompt,
attachments: publicAttachments,
status: `${channelLabel} · ${
parsed.workMode === 'execute'
? '执行'
: '对话'
}`
})
publishRemoteConversationChange()
publishRemoteConversationChange()
const remoteTaskId = randomUUID()
assistantDatabase.createTask({
id: remoteTaskId,
@@ -1658,7 +1658,6 @@ export function registerIpcHandlers(
detail: unavailable,
status: 'failed'
})
releaseRemoteContexts()
return { status: 'failed', error: unavailable }
}
if (
@@ -1692,7 +1691,6 @@ export function registerIpcHandlers(
detail: unavailable,
status: 'failed'
})
releaseRemoteContexts()
return { status: 'failed', error: unavailable }
}
}
@@ -1781,8 +1779,10 @@ export function registerIpcHandlers(
status:
result.status === 'completed' ? 'completed' : 'failed'
})
releaseRemoteContexts()
return result
} finally {
releaseRemoteContexts()
}
}
const channelManager = channelSettingsStore
? new ChannelManager(channelSettingsStore, channelExecutor, {