mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 09:21:26 +00:00
refactor(auto-reply): dedupe session touch
This commit is contained in:
@@ -157,22 +157,26 @@ export async function runReplyAgent(params: {
|
|||||||
buffer: createAudioAsVoiceBuffer({ isAudioPayload }),
|
buffer: createAudioAsVoiceBuffer({ isAudioPayload }),
|
||||||
})
|
})
|
||||||
: null;
|
: null;
|
||||||
|
const touchActiveSessionEntry = async () => {
|
||||||
|
if (!activeSessionEntry || !activeSessionStore || !sessionKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const updatedAt = Date.now();
|
||||||
|
activeSessionEntry.updatedAt = updatedAt;
|
||||||
|
activeSessionStore[sessionKey] = activeSessionEntry;
|
||||||
|
if (storePath) {
|
||||||
|
await updateSessionStoreEntry({
|
||||||
|
storePath,
|
||||||
|
sessionKey,
|
||||||
|
update: async () => ({ updatedAt }),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (shouldSteer && isStreaming) {
|
if (shouldSteer && isStreaming) {
|
||||||
const steered = queueEmbeddedPiMessage(followupRun.run.sessionId, followupRun.prompt);
|
const steered = queueEmbeddedPiMessage(followupRun.run.sessionId, followupRun.prompt);
|
||||||
if (steered && !shouldFollowup) {
|
if (steered && !shouldFollowup) {
|
||||||
if (activeSessionEntry && activeSessionStore && sessionKey) {
|
await touchActiveSessionEntry();
|
||||||
const updatedAt = Date.now();
|
|
||||||
activeSessionEntry.updatedAt = updatedAt;
|
|
||||||
activeSessionStore[sessionKey] = activeSessionEntry;
|
|
||||||
if (storePath) {
|
|
||||||
await updateSessionStoreEntry({
|
|
||||||
storePath,
|
|
||||||
sessionKey,
|
|
||||||
update: async () => ({ updatedAt }),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
typing.cleanup();
|
typing.cleanup();
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -180,18 +184,7 @@ export async function runReplyAgent(params: {
|
|||||||
|
|
||||||
if (isActive && (shouldFollowup || resolvedQueue.mode === "steer")) {
|
if (isActive && (shouldFollowup || resolvedQueue.mode === "steer")) {
|
||||||
enqueueFollowupRun(queueKey, followupRun, resolvedQueue);
|
enqueueFollowupRun(queueKey, followupRun, resolvedQueue);
|
||||||
if (activeSessionEntry && activeSessionStore && sessionKey) {
|
await touchActiveSessionEntry();
|
||||||
const updatedAt = Date.now();
|
|
||||||
activeSessionEntry.updatedAt = updatedAt;
|
|
||||||
activeSessionStore[sessionKey] = activeSessionEntry;
|
|
||||||
if (storePath) {
|
|
||||||
await updateSessionStoreEntry({
|
|
||||||
storePath,
|
|
||||||
sessionKey,
|
|
||||||
update: async () => ({ updatedAt }),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
typing.cleanup();
|
typing.cleanup();
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user