feat: add wechat publish recovery and conversation memory
This commit is contained in:
+13
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user