feat: split h5 direct chat from goosed tasks
This commit is contained in:
+17
-1
@@ -154,6 +154,22 @@ export function createConversationMemoryService(pool, options = {}) {
|
||||
const now = options.now ?? (() => Date.now());
|
||||
const fetchImpl = options.fetch ?? undiciFetch;
|
||||
const encryptionKey = options.encryptionKey;
|
||||
const llmWarningIntervalMs = Math.max(
|
||||
0,
|
||||
Number(options.llmWarningIntervalMs ?? process.env.USER_CONVERSATION_MEMORY_LLM_WARN_INTERVAL_MS ?? 60000) || 0,
|
||||
);
|
||||
let lastLlmExtractionWarningAt = 0;
|
||||
|
||||
function warnLlmExtractionFailed(err) {
|
||||
const ts = now();
|
||||
if (
|
||||
lastLlmExtractionWarningAt > 0 &&
|
||||
llmWarningIntervalMs > 0 &&
|
||||
ts - lastLlmExtractionWarningAt < llmWarningIntervalMs
|
||||
) return;
|
||||
lastLlmExtractionWarningAt = ts;
|
||||
console.warn('[conversation-memory] LLM extraction failed:', err instanceof Error ? err.message : err);
|
||||
}
|
||||
|
||||
function isEnabled() {
|
||||
return process.env.USER_CONVERSATION_MEMORY_ENABLED !== '0';
|
||||
@@ -318,7 +334,7 @@ export function createConversationMemoryService(pool, options = {}) {
|
||||
memories = await extractWithLlm(messages);
|
||||
extractionSucceeded = Array.isArray(memories);
|
||||
} catch (err) {
|
||||
console.warn('[conversation-memory] LLM extraction failed:', err instanceof Error ? err.message : err);
|
||||
warnLlmExtractionFailed(err);
|
||||
}
|
||||
}
|
||||
if (!memories) memories = fallbackMemoriesFromMessages(messages);
|
||||
|
||||
Reference in New Issue
Block a user