@mingxy/cerebro 1.5.9 → 1.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/hooks.ts +7 -1
package/package.json
CHANGED
package/src/hooks.ts
CHANGED
|
@@ -12,6 +12,11 @@ function showToast(tui: any, title: string, message: string, variant: string = "
|
|
|
12
12
|
}, delayMs);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
function extractUserRequest(content: string): string {
|
|
16
|
+
const match = content.match(/<user-request>([\s\S]*?)<\/user-request>/);
|
|
17
|
+
return match ? match[1].trim() : content;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
const keywordDetectedSessions = new Set<string>();
|
|
16
21
|
const injectedMemoryIds = new Map<string, Set<string>>();
|
|
17
22
|
const firstMessages = new Map<string, string>();
|
|
@@ -130,7 +135,8 @@ export function autoRecallHook(client: OmemClient, containerTags: string[], tui:
|
|
|
130
135
|
try {
|
|
131
136
|
const messages = sessionMessages.get(input.sessionID) ?? [];
|
|
132
137
|
const userMessages = messages.filter((m) => m.role === "user");
|
|
133
|
-
const
|
|
138
|
+
const rawQuery = userMessages[userMessages.length - 1]?.content || firstMessages.get(input.sessionID) || "";
|
|
139
|
+
const query_text = extractUserRequest(rawQuery);
|
|
134
140
|
const last_query_text = userMessages.length >= 2 ? userMessages[userMessages.length - 2].content : undefined;
|
|
135
141
|
|
|
136
142
|
const projectTags = containerTags.filter(t => t.startsWith("omem_project_"));
|