feat: split h5 direct chat from goosed tasks

This commit is contained in:
john
2026-07-04 14:01:00 +08:00
parent eb8d760dd9
commit 29d9a87d4f
18 changed files with 874 additions and 32 deletions
+17 -1
View File
@@ -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);