Skip to content

Commit 149764b

Browse files
committed
fix(long-memory): improve debug logging for long memory search and refine skip condition in query generation
1 parent f53777f commit 149764b

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

packages/long-memory/src/plugins/chat_middleware.ts

+5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ export function apply(ctx: Context, config: Config) {
4545
config.longMemoryInterval
4646
)
4747

48+
logger?.debug(
49+
`Long memory search content: ${searchContent}, chat history: ${JSON.stringify(
50+
chatHistory
51+
)}`
52+
)
4853
searchContent = await generateNewQuestion(
4954
ctx,
5055
config,

packages/long-memory/src/utils/chat-history.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function generateNewQuestion(
2222
const prompt = `
2323
Given the following conversation history and the user's question, generate a new search query that will help retrieve relevant information from a long-term memory database. The search query should be concise and focused on the key information needs.
2424
25-
If you think the user's question is a casual greeting, a simple question that doesn't need memory retrieval, just respond with "[skip]".
25+
If you think the user's question is a casual greeting, or a simple question that doesn't need more info, just respond with "[skip]".
2626
2727
Conversation History:
2828
${chatHistory}
@@ -132,8 +132,6 @@ export async function extractMemoriesFromChat(
132132
return []
133133
}
134134

135-
logger?.debug(`Long memory extract: ${JSON.stringify(memories)}`)
136-
137135
return memories
138136
}
139137

packages/long-memory/src/utils/similarity.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ export async function filterSimilarMemoryByVectorStore(
334334
result.push(memory)
335335
} else {
336336
logger?.debug(
337-
`Skip similar memory: ${memory.content}, threshold: ${similarityThreshold}`
337+
`Skip memory: ${memory.content}, threshold: ${similarityThreshold}`
338338
)
339339
}
340340
}

0 commit comments

Comments
 (0)