Fix OpenClaw Mem0 custom categories payload (#5345)
Co-authored-by: Kartik <kartik.labhshetwar@mem0.ai>
This commit is contained in:
@@ -13,6 +13,16 @@ import type {
|
||||
AddResult,
|
||||
} from "./types.ts";
|
||||
|
||||
export function customCategoryMapToList(
|
||||
categories?: Record<string, string>,
|
||||
): Array<Record<string, string>> | undefined {
|
||||
if (!categories || typeof categories !== "object") return undefined;
|
||||
const items = Object.entries(categories).map(([name, description]) => ({
|
||||
[name]: description,
|
||||
}));
|
||||
return items.length ? items : undefined;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Result Normalizers
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user