feat: add wechat publish recovery and conversation memory

This commit is contained in:
john
2026-06-29 06:59:37 +08:00
parent ea19ffb5fa
commit e80831ad4f
12 changed files with 2308 additions and 38 deletions
+13 -1
View File
@@ -62,7 +62,9 @@ function resolveDisplayTitle(session, messages) {
return deriveTitleFromMessages(messages);
}
export function createSessionSnapshotService(pool) {
export function createSessionSnapshotService(pool, options = {}) {
const conversationMemoryService = options.conversationMemoryService ?? null;
function isEnabled() {
return process.env.SESSION_SNAPSHOT_CACHE_ENABLED !== '0';
}
@@ -138,6 +140,16 @@ export function createSessionSnapshotService(pool) {
now,
],
);
if (conversationMemoryService?.isEnabled?.()) {
void conversationMemoryService
.saveAndAnalyze(sessionId, userId, messages)
.catch((err) => {
console.warn(
'[snapshot] conversation memory sync failed:',
err instanceof Error ? err.message : err,
);
});
}
} catch (err) {
// Non-fatal: log and continue; caller falls back to Goose.
console.warn('[snapshot] save failed:', err instanceof Error ? err.message : err);