|
@@ -8,6 +8,8 @@ async function run() {
|
|
|
const timestamp = new Date().toISOString();
|
|
const timestamp = new Date().toISOString();
|
|
|
const text = `openclaw-mem0-python plugin test at ${timestamp}`;
|
|
const text = `openclaw-mem0-python plugin test at ${timestamp}`;
|
|
|
|
|
|
|
|
|
|
+ const baseUrl = process.env.MEM0_BASE_URL || "http://192.168.0.200:8420";
|
|
|
|
|
+
|
|
|
console.log("Writing memory...");
|
|
console.log("Writing memory...");
|
|
|
const writeResult = await plugin.write({ text, userId });
|
|
const writeResult = await plugin.write({ text, userId });
|
|
|
console.log("Write result:", writeResult);
|
|
console.log("Write result:", writeResult);
|
|
@@ -40,6 +42,23 @@ async function run() {
|
|
|
} else {
|
|
} else {
|
|
|
console.log("No knowledge sources found; skipping book tests.");
|
|
console.log("No knowledge sources found; skipping book tests.");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ console.log("Cleaning up test memories...");
|
|
|
|
|
+ const allRes = await fetch(`${baseUrl}/memories/all`, {
|
|
|
|
|
+ method: "POST",
|
|
|
|
|
+ headers: { "Content-Type": "application/json" },
|
|
|
|
|
+ body: JSON.stringify({ user_id: userId }),
|
|
|
|
|
+ }).then((r) => r.json());
|
|
|
|
|
+
|
|
|
|
|
+ const ids = (allRes?.results || []).map((r) => r.id).filter(Boolean);
|
|
|
|
|
+ for (const id of ids) {
|
|
|
|
|
+ await fetch(`${baseUrl}/memory/${id}`, {
|
|
|
|
|
+ method: "DELETE",
|
|
|
|
|
+ headers: { "Content-Type": "application/json" },
|
|
|
|
|
+ body: JSON.stringify({ collection: "conversational" }),
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(`Cleanup done (${ids.length} deleted).`);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
run().catch((err) => {
|
|
run().catch((err) => {
|