|
|
@@ -466,10 +466,18 @@ export default async function handler(event: HookEvent) {
|
|
|
captureTrigger,
|
|
|
text: captureText.slice(0, 160),
|
|
|
});
|
|
|
+ const payload = {
|
|
|
+ user_id: userId,
|
|
|
+ messages: recent.map((entry) => ({ role: "user", content: entry })),
|
|
|
+ metadata: {
|
|
|
+ source: "mem0_hook",
|
|
|
+ session: event.sessionKey || "unknown",
|
|
|
+ },
|
|
|
+ };
|
|
|
await fetch(`${pluginCfg.baseUrl}/memories`, {
|
|
|
method: "POST",
|
|
|
headers: { "Content-Type": "application/json" },
|
|
|
- body: JSON.stringify({ text: captureText, userId }),
|
|
|
+ body: JSON.stringify(payload),
|
|
|
});
|
|
|
} catch (err) {
|
|
|
console.error("[mem0-auto-capture] write failed:", err);
|