Add page data delivery and publication guards
This commit is contained in:
+10
-13
@@ -21,6 +21,7 @@ import { createSessionBrokerMetrics, isSessionBrokerMetricsEnabled } from './ses
|
||||
import { createImgproxySigner } from './imgproxy-signer.mjs';
|
||||
import { isDirectChatSessionId } from './direct-chat-service.mjs';
|
||||
import { ensureGooseUserMessageMetadata } from './goose-message.mjs';
|
||||
import { filterMemoriesByQuery, resolveMemoriesWithLegacyFallback } from './memory-legacy-fallback.mjs';
|
||||
import { consumeSessionEventsUntilFinish } from './session-reply-wait.mjs';
|
||||
import {
|
||||
memoryLimitForIntervention,
|
||||
@@ -1152,19 +1153,15 @@ export function createTkmindProxy({
|
||||
const resolvedLimit = Number.isFinite(Number(limit)) && Number(limit) > 0
|
||||
? Number(limit)
|
||||
: memoryLimitForIntervention(intervention, { context: 'agent' });
|
||||
if (resolvedLimit <= 0) return [];
|
||||
if (memoryV2?.resolve) {
|
||||
const resolved = await memoryV2.resolve({
|
||||
userId,
|
||||
sessionId,
|
||||
query,
|
||||
limit: resolvedLimit,
|
||||
}).catch(() => null);
|
||||
return Array.isArray(resolved?.memories) ? resolved.memories : [];
|
||||
}
|
||||
return conversationMemoryService?.listMemories
|
||||
? conversationMemoryService.listMemories(userId, { limit: resolvedLimit }).catch(() => [])
|
||||
: [];
|
||||
return resolveMemoriesWithLegacyFallback({
|
||||
memoryV2,
|
||||
conversationMemoryService,
|
||||
userId,
|
||||
sessionId,
|
||||
query,
|
||||
limit: resolvedLimit,
|
||||
recallQuestion,
|
||||
});
|
||||
}
|
||||
|
||||
async function startSessionForUser(
|
||||
|
||||
Reference in New Issue
Block a user