fix: recall without parameters now returns all memories like list
When the model calls recall without key or category (e.g., 'what memories do you have?'), it now returns all memories across all categories instead of an error. This provides better UX since models often use recall instead of list for memory queries.
This commit is contained in:
@@ -707,7 +707,20 @@ switch (action) {
|
||||
return { found: false, key };
|
||||
}
|
||||
|
||||
return { error: 'Provide key and/or category' };
|
||||
// No key or category provided - return all memories (like list)
|
||||
const allMemories = {};
|
||||
for (const cat in memory) {
|
||||
allMemories[cat] = Object.entries(memory[cat]).map(([k, data]) => ({
|
||||
key: k,
|
||||
value: data.value,
|
||||
stored: data.stored
|
||||
}));
|
||||
}
|
||||
return {
|
||||
memories: allMemories,
|
||||
totalCategories: Object.keys(memory).length,
|
||||
totalEntries: Object.values(memory).reduce((sum, cat) => sum + Object.keys(cat).length, 0)
|
||||
};
|
||||
}
|
||||
|
||||
case 'list': {
|
||||
|
||||
Reference in New Issue
Block a user