@lobehub/lobehub 2.0.0-next.360 → 2.0.0-next.362
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/CHANGELOG.md +50 -0
- package/Dockerfile +2 -1
- package/changelog/v1.json +14 -0
- package/locales/en-US/chat.json +3 -1
- package/locales/zh-CN/chat.json +2 -0
- package/package.json +1 -1
- package/packages/const/src/userMemory.ts +1 -0
- package/packages/context-engine/src/base/BaseEveryUserContentProvider.ts +204 -0
- package/packages/context-engine/src/base/BaseLastUserContentProvider.ts +1 -8
- package/packages/context-engine/src/base/__tests__/BaseEveryUserContentProvider.test.ts +354 -0
- package/packages/context-engine/src/base/constants.ts +20 -0
- package/packages/context-engine/src/engine/messages/MessagesEngine.ts +27 -23
- package/packages/context-engine/src/engine/messages/__tests__/MessagesEngine.test.ts +364 -0
- package/packages/context-engine/src/providers/PageEditorContextInjector.ts +17 -13
- package/packages/context-engine/src/providers/PageSelectionsInjector.ts +65 -0
- package/packages/context-engine/src/providers/__tests__/PageSelectionsInjector.test.ts +333 -0
- package/packages/context-engine/src/providers/index.ts +3 -1
- package/packages/database/src/models/userMemory/model.ts +178 -3
- package/packages/database/src/models/userMemory/sources/benchmarkLoCoMo.ts +1 -1
- package/packages/memory-user-memory/package.json +2 -1
- package/packages/memory-user-memory/promptfoo/evals/activity/basic/buildMessages.ts +40 -0
- package/packages/memory-user-memory/promptfoo/evals/activity/basic/eval.yaml +13 -0
- package/packages/memory-user-memory/promptfoo/evals/activity/basic/prompt.ts +5 -0
- package/packages/memory-user-memory/promptfoo/evals/activity/basic/tests/cases.ts +106 -0
- package/packages/memory-user-memory/promptfoo/evals/activity/locomo/buildMessages.ts +104 -0
- package/packages/memory-user-memory/promptfoo/evals/activity/locomo/eval.yaml +13 -0
- package/packages/memory-user-memory/promptfoo/evals/activity/locomo/prompt.ts +5 -0
- package/packages/memory-user-memory/promptfoo/evals/activity/locomo/tests/benchmark-locomo-payload-conv-26.json +149 -0
- package/packages/memory-user-memory/promptfoo/evals/activity/locomo/tests/cases.ts +72 -0
- package/packages/memory-user-memory/promptfoo/response-formats/activity.json +370 -0
- package/packages/memory-user-memory/promptfoo/response-formats/experience.json +14 -0
- package/packages/memory-user-memory/promptfoo/response-formats/identity.json +281 -255
- package/packages/memory-user-memory/promptfooconfig.yaml +1 -0
- package/packages/memory-user-memory/scripts/generate-response-formats.ts +26 -2
- package/packages/memory-user-memory/src/extractors/activity.ts +44 -0
- package/packages/memory-user-memory/src/extractors/gatekeeper.test.ts +2 -1
- package/packages/memory-user-memory/src/extractors/gatekeeper.ts +2 -1
- package/packages/memory-user-memory/src/extractors/index.ts +1 -0
- package/packages/memory-user-memory/src/prompts/gatekeeper.ts +3 -3
- package/packages/memory-user-memory/src/prompts/index.ts +7 -1
- package/packages/memory-user-memory/src/prompts/layers/activity.ts +90 -0
- package/packages/memory-user-memory/src/prompts/layers/index.ts +1 -0
- package/packages/memory-user-memory/src/providers/existingUserMemory.test.ts +25 -1
- package/packages/memory-user-memory/src/providers/existingUserMemory.ts +113 -0
- package/packages/memory-user-memory/src/schemas/activity.ts +315 -0
- package/packages/memory-user-memory/src/schemas/experience.ts +5 -5
- package/packages/memory-user-memory/src/schemas/gatekeeper.ts +1 -0
- package/packages/memory-user-memory/src/schemas/index.ts +1 -0
- package/packages/memory-user-memory/src/services/extractExecutor.ts +29 -0
- package/packages/memory-user-memory/src/types.ts +7 -0
- package/packages/prompts/src/agents/index.ts +1 -0
- package/packages/prompts/src/agents/pageSelectionContext.ts +28 -0
- package/packages/types/src/aiChat.ts +4 -0
- package/packages/types/src/message/common/index.ts +1 -0
- package/packages/types/src/message/common/metadata.ts +8 -0
- package/packages/types/src/message/common/pageSelection.ts +36 -0
- package/packages/types/src/message/ui/params.ts +16 -0
- package/packages/types/src/serverConfig.ts +1 -1
- package/packages/types/src/userMemory/layers.ts +52 -0
- package/packages/types/src/userMemory/list.ts +20 -2
- package/packages/types/src/userMemory/shared.ts +22 -1
- package/packages/types/src/userMemory/trace.ts +1 -0
- package/packages/types/src/util.ts +9 -1
- package/scripts/prebuild.mts +1 -0
- package/src/features/ChatInput/Desktop/ContextContainer/ContextList.tsx +1 -1
- package/src/features/Conversation/ChatInput/index.tsx +9 -1
- package/src/features/Conversation/Messages/User/components/MessageContent.tsx +7 -1
- package/src/features/Conversation/Messages/User/components/PageSelections.tsx +62 -0
- package/src/features/PageEditor/EditorCanvas/useAskCopilotItem.tsx +5 -1
- package/src/libs/next/proxy/define-config.ts +1 -0
- package/src/locales/default/chat.ts +3 -2
- package/src/server/globalConfig/parseMemoryExtractionConfig.ts +7 -1
- package/src/server/routers/lambda/aiChat.ts +7 -0
- package/src/server/services/memory/userMemory/__tests__/extract.runtime.test.ts +2 -0
- package/src/server/services/memory/userMemory/extract.ts +108 -7
- package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +5 -19
|
@@ -3,192 +3,10 @@
|
|
|
3
3
|
"type": "object",
|
|
4
4
|
"properties": {
|
|
5
5
|
"add": {
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"details": {
|
|
11
|
-
"type": [
|
|
12
|
-
"string",
|
|
13
|
-
"null"
|
|
14
|
-
],
|
|
15
|
-
"description": "Optional detailed information"
|
|
16
|
-
},
|
|
17
|
-
"memoryCategory": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"description": "Memory category"
|
|
20
|
-
},
|
|
21
|
-
"memoryLayer": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"const": "identity",
|
|
24
|
-
"description": "Memory layer"
|
|
25
|
-
},
|
|
26
|
-
"memoryType": {
|
|
27
|
-
"type": "string",
|
|
28
|
-
"enum": [
|
|
29
|
-
"activity",
|
|
30
|
-
"context",
|
|
31
|
-
"event",
|
|
32
|
-
"fact",
|
|
33
|
-
"location",
|
|
34
|
-
"other",
|
|
35
|
-
"people",
|
|
36
|
-
"preference",
|
|
37
|
-
"technology",
|
|
38
|
-
"topic"
|
|
39
|
-
],
|
|
40
|
-
"description": "Memory type"
|
|
41
|
-
},
|
|
42
|
-
"summary": {
|
|
43
|
-
"type": "string",
|
|
44
|
-
"description": "Concise overview of this specific memory"
|
|
45
|
-
},
|
|
46
|
-
"tags": {
|
|
47
|
-
"type": "array",
|
|
48
|
-
"items": {
|
|
49
|
-
"type": "string"
|
|
50
|
-
},
|
|
51
|
-
"description": "Model generated tags that summarize the identity facets"
|
|
52
|
-
},
|
|
53
|
-
"title": {
|
|
54
|
-
"type": "string",
|
|
55
|
-
"description": "Brief descriptive title"
|
|
56
|
-
},
|
|
57
|
-
"withIdentity": {
|
|
58
|
-
"type": "object",
|
|
59
|
-
"properties": {
|
|
60
|
-
"description": {
|
|
61
|
-
"type": "string"
|
|
62
|
-
},
|
|
63
|
-
"episodicDate": {
|
|
64
|
-
"type": [
|
|
65
|
-
"string",
|
|
66
|
-
"null"
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
"extractedLabels": {
|
|
70
|
-
"type": "array",
|
|
71
|
-
"items": {
|
|
72
|
-
"type": "string"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"relationship": {
|
|
76
|
-
"type": "string",
|
|
77
|
-
"enum": [
|
|
78
|
-
"self",
|
|
79
|
-
"father",
|
|
80
|
-
"mother",
|
|
81
|
-
"son",
|
|
82
|
-
"daughter",
|
|
83
|
-
"brother",
|
|
84
|
-
"sister",
|
|
85
|
-
"sibling",
|
|
86
|
-
"husband",
|
|
87
|
-
"wife",
|
|
88
|
-
"spouse",
|
|
89
|
-
"partner",
|
|
90
|
-
"couple",
|
|
91
|
-
"friend",
|
|
92
|
-
"colleague",
|
|
93
|
-
"coworker",
|
|
94
|
-
"classmate",
|
|
95
|
-
"mentor",
|
|
96
|
-
"mentee",
|
|
97
|
-
"manager",
|
|
98
|
-
"teammate",
|
|
99
|
-
"grandfather",
|
|
100
|
-
"grandmother",
|
|
101
|
-
"grandson",
|
|
102
|
-
"granddaughter",
|
|
103
|
-
"uncle",
|
|
104
|
-
"aunt",
|
|
105
|
-
"nephew",
|
|
106
|
-
"niece",
|
|
107
|
-
"other"
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
"role": {
|
|
111
|
-
"type": "string"
|
|
112
|
-
},
|
|
113
|
-
"scoreConfidence": {
|
|
114
|
-
"type": "number"
|
|
115
|
-
},
|
|
116
|
-
"sourceEvidence": {
|
|
117
|
-
"type": [
|
|
118
|
-
"string",
|
|
119
|
-
"null"
|
|
120
|
-
]
|
|
121
|
-
},
|
|
122
|
-
"type": {
|
|
123
|
-
"type": "string",
|
|
124
|
-
"enum": [
|
|
125
|
-
"professional",
|
|
126
|
-
"personal",
|
|
127
|
-
"demographic"
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
"required": [
|
|
132
|
-
"description",
|
|
133
|
-
"episodicDate",
|
|
134
|
-
"extractedLabels",
|
|
135
|
-
"relationship",
|
|
136
|
-
"role",
|
|
137
|
-
"scoreConfidence",
|
|
138
|
-
"sourceEvidence",
|
|
139
|
-
"type"
|
|
140
|
-
],
|
|
141
|
-
"additionalProperties": false
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
"required": [
|
|
145
|
-
"details",
|
|
146
|
-
"memoryCategory",
|
|
147
|
-
"memoryLayer",
|
|
148
|
-
"memoryType",
|
|
149
|
-
"summary",
|
|
150
|
-
"tags",
|
|
151
|
-
"title",
|
|
152
|
-
"withIdentity"
|
|
153
|
-
],
|
|
154
|
-
"additionalProperties": false
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
"remove": {
|
|
158
|
-
"type": "array",
|
|
159
|
-
"items": {
|
|
160
|
-
"type": "object",
|
|
161
|
-
"properties": {
|
|
162
|
-
"id": {
|
|
163
|
-
"type": "string"
|
|
164
|
-
},
|
|
165
|
-
"reason": {
|
|
166
|
-
"type": "string"
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
"required": [
|
|
170
|
-
"id",
|
|
171
|
-
"reason"
|
|
172
|
-
],
|
|
173
|
-
"additionalProperties": false
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
"update": {
|
|
177
|
-
"type": "array",
|
|
178
|
-
"items": {
|
|
179
|
-
"type": "object",
|
|
180
|
-
"properties": {
|
|
181
|
-
"id": {
|
|
182
|
-
"type": "string"
|
|
183
|
-
},
|
|
184
|
-
"mergeStrategy": {
|
|
185
|
-
"type": "string",
|
|
186
|
-
"enum": [
|
|
187
|
-
"merge",
|
|
188
|
-
"replace"
|
|
189
|
-
]
|
|
190
|
-
},
|
|
191
|
-
"set": {
|
|
6
|
+
"anyOf": [
|
|
7
|
+
{
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": {
|
|
192
10
|
"type": "object",
|
|
193
11
|
"properties": {
|
|
194
12
|
"details": {
|
|
@@ -196,14 +14,16 @@
|
|
|
196
14
|
"string",
|
|
197
15
|
"null"
|
|
198
16
|
],
|
|
199
|
-
"description": "Optional detailed information
|
|
17
|
+
"description": "Optional detailed information"
|
|
200
18
|
},
|
|
201
19
|
"memoryCategory": {
|
|
202
|
-
"type":
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
"
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Memory category"
|
|
22
|
+
},
|
|
23
|
+
"memoryLayer": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"const": "identity",
|
|
26
|
+
"description": "Memory layer"
|
|
207
27
|
},
|
|
208
28
|
"memoryType": {
|
|
209
29
|
"type": "string",
|
|
@@ -219,44 +39,28 @@
|
|
|
219
39
|
"technology",
|
|
220
40
|
"topic"
|
|
221
41
|
],
|
|
222
|
-
"description": "Memory type
|
|
42
|
+
"description": "Memory type"
|
|
223
43
|
},
|
|
224
44
|
"summary": {
|
|
225
|
-
"type":
|
|
226
|
-
|
|
227
|
-
"null"
|
|
228
|
-
],
|
|
229
|
-
"description": "Concise overview of this specific memory, use null for omitting the field"
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Concise overview of this specific memory"
|
|
230
47
|
},
|
|
231
48
|
"tags": {
|
|
232
|
-
"
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"type": "null"
|
|
241
|
-
}
|
|
242
|
-
],
|
|
243
|
-
"description": "Model generated tags that summarize the identity facets, use null for omitting the field"
|
|
49
|
+
"type": "array",
|
|
50
|
+
"items": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"description": "Model generated tags that summarize the identity facets"
|
|
244
54
|
},
|
|
245
55
|
"title": {
|
|
246
|
-
"type":
|
|
247
|
-
|
|
248
|
-
"null"
|
|
249
|
-
],
|
|
250
|
-
"description": "Brief descriptive title, use null for omitting the field"
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "Honorific-style, concise descriptor (strength + domain/milestone), avoid bare job titles; e.g., \"Trusted open-source maintainer\", \"Specializes in low-latency infra\", \"Former Aliyun engineer\", \"Cares for rescue cats\""
|
|
251
58
|
},
|
|
252
59
|
"withIdentity": {
|
|
253
60
|
"type": "object",
|
|
254
61
|
"properties": {
|
|
255
62
|
"description": {
|
|
256
|
-
"type":
|
|
257
|
-
"string",
|
|
258
|
-
"null"
|
|
259
|
-
]
|
|
63
|
+
"type": "string"
|
|
260
64
|
},
|
|
261
65
|
"episodicDate": {
|
|
262
66
|
"type": [
|
|
@@ -265,36 +69,52 @@
|
|
|
265
69
|
]
|
|
266
70
|
},
|
|
267
71
|
"extractedLabels": {
|
|
268
|
-
"
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
"type": "string"
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
"type": "null"
|
|
277
|
-
}
|
|
278
|
-
]
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "string"
|
|
75
|
+
}
|
|
279
76
|
},
|
|
280
77
|
"relationship": {
|
|
281
|
-
"type":
|
|
282
|
-
|
|
283
|
-
"
|
|
284
|
-
|
|
285
|
-
|
|
78
|
+
"type": "string",
|
|
79
|
+
"enum": [
|
|
80
|
+
"self",
|
|
81
|
+
"father",
|
|
82
|
+
"mother",
|
|
83
|
+
"son",
|
|
84
|
+
"daughter",
|
|
85
|
+
"brother",
|
|
86
|
+
"sister",
|
|
87
|
+
"sibling",
|
|
88
|
+
"husband",
|
|
89
|
+
"wife",
|
|
90
|
+
"spouse",
|
|
91
|
+
"partner",
|
|
92
|
+
"couple",
|
|
93
|
+
"friend",
|
|
94
|
+
"colleague",
|
|
95
|
+
"coworker",
|
|
96
|
+
"classmate",
|
|
97
|
+
"mentor",
|
|
98
|
+
"mentee",
|
|
99
|
+
"manager",
|
|
100
|
+
"teammate",
|
|
101
|
+
"grandfather",
|
|
102
|
+
"grandmother",
|
|
103
|
+
"grandson",
|
|
104
|
+
"granddaughter",
|
|
105
|
+
"uncle",
|
|
106
|
+
"aunt",
|
|
107
|
+
"nephew",
|
|
108
|
+
"niece",
|
|
109
|
+
"other"
|
|
110
|
+
]
|
|
286
111
|
},
|
|
287
112
|
"role": {
|
|
288
|
-
"type":
|
|
289
|
-
|
|
290
|
-
"null"
|
|
291
|
-
]
|
|
113
|
+
"type": "string",
|
|
114
|
+
"description": "Role explicitly mentioned for this identity entry (e.g., \"platform engineer\", \"caregiver\"); keep neutral and only use when evidence exists"
|
|
292
115
|
},
|
|
293
116
|
"scoreConfidence": {
|
|
294
|
-
"type":
|
|
295
|
-
"number",
|
|
296
|
-
"null"
|
|
297
|
-
]
|
|
117
|
+
"type": "number"
|
|
298
118
|
},
|
|
299
119
|
"sourceEvidence": {
|
|
300
120
|
"type": [
|
|
@@ -303,11 +123,12 @@
|
|
|
303
123
|
]
|
|
304
124
|
},
|
|
305
125
|
"type": {
|
|
306
|
-
"type":
|
|
307
|
-
|
|
308
|
-
"
|
|
309
|
-
|
|
310
|
-
|
|
126
|
+
"type": "string",
|
|
127
|
+
"enum": [
|
|
128
|
+
"professional",
|
|
129
|
+
"personal",
|
|
130
|
+
"demographic"
|
|
131
|
+
]
|
|
311
132
|
}
|
|
312
133
|
},
|
|
313
134
|
"required": [
|
|
@@ -326,6 +147,7 @@
|
|
|
326
147
|
"required": [
|
|
327
148
|
"details",
|
|
328
149
|
"memoryCategory",
|
|
150
|
+
"memoryLayer",
|
|
329
151
|
"memoryType",
|
|
330
152
|
"summary",
|
|
331
153
|
"tags",
|
|
@@ -335,13 +157,217 @@
|
|
|
335
157
|
"additionalProperties": false
|
|
336
158
|
}
|
|
337
159
|
},
|
|
338
|
-
|
|
339
|
-
"
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
160
|
+
{
|
|
161
|
+
"type": "null"
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
"description": "Identity entries to add; use an empty array when nothing to add"
|
|
165
|
+
},
|
|
166
|
+
"remove": {
|
|
167
|
+
"anyOf": [
|
|
168
|
+
{
|
|
169
|
+
"type": "array",
|
|
170
|
+
"items": {
|
|
171
|
+
"type": "object",
|
|
172
|
+
"properties": {
|
|
173
|
+
"id": {
|
|
174
|
+
"type": "string"
|
|
175
|
+
},
|
|
176
|
+
"reason": {
|
|
177
|
+
"type": "string"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"required": [
|
|
181
|
+
"id",
|
|
182
|
+
"reason"
|
|
183
|
+
],
|
|
184
|
+
"additionalProperties": false
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"type": "null"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"description": "Identity entries to remove; use an empty array when nothing to remove"
|
|
192
|
+
},
|
|
193
|
+
"update": {
|
|
194
|
+
"anyOf": [
|
|
195
|
+
{
|
|
196
|
+
"type": "array",
|
|
197
|
+
"items": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"properties": {
|
|
200
|
+
"id": {
|
|
201
|
+
"type": "string"
|
|
202
|
+
},
|
|
203
|
+
"mergeStrategy": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"enum": [
|
|
206
|
+
"merge",
|
|
207
|
+
"replace"
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
"set": {
|
|
211
|
+
"type": "object",
|
|
212
|
+
"properties": {
|
|
213
|
+
"details": {
|
|
214
|
+
"type": [
|
|
215
|
+
"string",
|
|
216
|
+
"null"
|
|
217
|
+
],
|
|
218
|
+
"description": "Optional detailed information, use null for omitting the field"
|
|
219
|
+
},
|
|
220
|
+
"memoryCategory": {
|
|
221
|
+
"type": [
|
|
222
|
+
"string",
|
|
223
|
+
"null"
|
|
224
|
+
],
|
|
225
|
+
"description": "Memory category, use null for omitting the field"
|
|
226
|
+
},
|
|
227
|
+
"memoryType": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"enum": [
|
|
230
|
+
"activity",
|
|
231
|
+
"context",
|
|
232
|
+
"event",
|
|
233
|
+
"fact",
|
|
234
|
+
"location",
|
|
235
|
+
"other",
|
|
236
|
+
"people",
|
|
237
|
+
"preference",
|
|
238
|
+
"technology",
|
|
239
|
+
"topic"
|
|
240
|
+
],
|
|
241
|
+
"description": "Memory type, use null for omitting the field"
|
|
242
|
+
},
|
|
243
|
+
"summary": {
|
|
244
|
+
"type": [
|
|
245
|
+
"string",
|
|
246
|
+
"null"
|
|
247
|
+
],
|
|
248
|
+
"description": "Concise overview of this specific memory, use null for omitting the field"
|
|
249
|
+
},
|
|
250
|
+
"tags": {
|
|
251
|
+
"anyOf": [
|
|
252
|
+
{
|
|
253
|
+
"type": "array",
|
|
254
|
+
"items": {
|
|
255
|
+
"type": "string"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"type": "null"
|
|
260
|
+
}
|
|
261
|
+
],
|
|
262
|
+
"description": "Model generated tags that summarize the identity facets, use null for omitting the field"
|
|
263
|
+
},
|
|
264
|
+
"title": {
|
|
265
|
+
"type": [
|
|
266
|
+
"string",
|
|
267
|
+
"null"
|
|
268
|
+
],
|
|
269
|
+
"description": "Honorific-style, concise descriptor (strength + domain/milestone), avoid bare job titles; e.g., \"Trusted open-source maintainer\", \"Specializes in low-latency infra\", \"Former Aliyun engineer\", \"Cares for rescue cats\"; use null for omitting the field"
|
|
270
|
+
},
|
|
271
|
+
"withIdentity": {
|
|
272
|
+
"type": "object",
|
|
273
|
+
"properties": {
|
|
274
|
+
"description": {
|
|
275
|
+
"type": [
|
|
276
|
+
"string",
|
|
277
|
+
"null"
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
"episodicDate": {
|
|
281
|
+
"type": [
|
|
282
|
+
"string",
|
|
283
|
+
"null"
|
|
284
|
+
]
|
|
285
|
+
},
|
|
286
|
+
"extractedLabels": {
|
|
287
|
+
"anyOf": [
|
|
288
|
+
{
|
|
289
|
+
"type": "array",
|
|
290
|
+
"items": {
|
|
291
|
+
"type": "string"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"type": "null"
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
},
|
|
299
|
+
"relationship": {
|
|
300
|
+
"type": [
|
|
301
|
+
"string",
|
|
302
|
+
"null"
|
|
303
|
+
],
|
|
304
|
+
"description": "Possible values: self | father | mother | son | daughter | brother | sister | sibling | husband | wife | spouse | partner | couple | friend | colleague | coworker | classmate | mentor | mentee | manager | teammate | grandfather | grandmother | grandson | granddaughter | uncle | aunt | nephew | niece | other"
|
|
305
|
+
},
|
|
306
|
+
"role": {
|
|
307
|
+
"type": [
|
|
308
|
+
"string",
|
|
309
|
+
"null"
|
|
310
|
+
],
|
|
311
|
+
"description": "Role explicitly mentioned for this identity entry (e.g., \"platform engineer\", \"caregiver\"); keep existing when not updated; use null for omitting the field"
|
|
312
|
+
},
|
|
313
|
+
"scoreConfidence": {
|
|
314
|
+
"type": [
|
|
315
|
+
"number",
|
|
316
|
+
"null"
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
"sourceEvidence": {
|
|
320
|
+
"type": [
|
|
321
|
+
"string",
|
|
322
|
+
"null"
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
"type": {
|
|
326
|
+
"type": [
|
|
327
|
+
"string",
|
|
328
|
+
"null"
|
|
329
|
+
],
|
|
330
|
+
"description": "Possible values: professional | personal | demographic"
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"required": [
|
|
334
|
+
"description",
|
|
335
|
+
"episodicDate",
|
|
336
|
+
"extractedLabels",
|
|
337
|
+
"relationship",
|
|
338
|
+
"role",
|
|
339
|
+
"scoreConfidence",
|
|
340
|
+
"sourceEvidence",
|
|
341
|
+
"type"
|
|
342
|
+
],
|
|
343
|
+
"additionalProperties": false
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"required": [
|
|
347
|
+
"details",
|
|
348
|
+
"memoryCategory",
|
|
349
|
+
"memoryType",
|
|
350
|
+
"summary",
|
|
351
|
+
"tags",
|
|
352
|
+
"title",
|
|
353
|
+
"withIdentity"
|
|
354
|
+
],
|
|
355
|
+
"additionalProperties": false
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
"required": [
|
|
359
|
+
"id",
|
|
360
|
+
"mergeStrategy",
|
|
361
|
+
"set"
|
|
362
|
+
],
|
|
363
|
+
"additionalProperties": false
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"type": "null"
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
"description": "Identity entries to update; use an empty array when nothing to update"
|
|
345
371
|
}
|
|
346
372
|
},
|
|
347
373
|
"required": [
|
|
@@ -3,6 +3,7 @@ description: LobeHub Prompts (memory-user-memory) Testing Suite
|
|
|
3
3
|
# Test configurations - run all prompt tests
|
|
4
4
|
testPaths:
|
|
5
5
|
- promptfoo/evals/identity/with-s3-trace/eval.yaml
|
|
6
|
+
- promptfoo/evals/activity/basic/eval.yaml
|
|
6
7
|
|
|
7
8
|
# Output configuration
|
|
8
9
|
outputPath: promptfoo-results.json
|
|
@@ -3,7 +3,15 @@ import { mkdir, writeFile } from 'node:fs/promises';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { exit } from 'node:process';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import type { GenerateObjectSchema } from '@lobechat/model-runtime';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ActivityMemorySchema,
|
|
10
|
+
ContextMemorySchema,
|
|
11
|
+
IdentityActionsSchema,
|
|
12
|
+
PreferenceMemorySchema,
|
|
13
|
+
ExperienceMemorySchema,
|
|
14
|
+
} from '../src/schemas';
|
|
7
15
|
import { buildGenerateObjectSchema } from '../src/utils/zod';
|
|
8
16
|
|
|
9
17
|
const OUTPUT_DIR = join(process.cwd(), 'promptfoo/response-formats');
|
|
@@ -22,6 +30,22 @@ const writeSchema = async (name: string, schema: any, description: string) => {
|
|
|
22
30
|
console.log(`Wrote ${outPath}`);
|
|
23
31
|
};
|
|
24
32
|
|
|
33
|
+
const writeGenerateObjectSchema = async (name: string, generateSchema: GenerateObjectSchema) => {
|
|
34
|
+
const responseFormat: { json_schema: GenerateObjectSchema, type: 'json_schema' } = {
|
|
35
|
+
json_schema: {
|
|
36
|
+
name: generateSchema.name || name,
|
|
37
|
+
schema: generateSchema.schema,
|
|
38
|
+
strict: generateSchema.strict,
|
|
39
|
+
},
|
|
40
|
+
type: 'json_schema' as const,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const outPath = join(OUTPUT_DIR, `${name}.json`);
|
|
44
|
+
await writeFile(outPath, JSON.stringify(responseFormat, null, 2), 'utf8');
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.log(`Wrote ${outPath}`);
|
|
47
|
+
};
|
|
48
|
+
|
|
25
49
|
async function main() {
|
|
26
50
|
await mkdir(OUTPUT_DIR, { recursive: true });
|
|
27
51
|
|
|
@@ -29,6 +53,7 @@ async function main() {
|
|
|
29
53
|
await writeSchema('context', ContextMemorySchema, 'Context layer actions');
|
|
30
54
|
await writeSchema('preference', PreferenceMemorySchema, 'Preference layer memories');
|
|
31
55
|
await writeSchema('experience', ExperienceMemorySchema, 'Experience layer memories');
|
|
56
|
+
await writeGenerateObjectSchema('activity', ActivityMemorySchema);
|
|
32
57
|
}
|
|
33
58
|
|
|
34
59
|
main().catch((err) => {
|
|
@@ -36,4 +61,3 @@ main().catch((err) => {
|
|
|
36
61
|
console.error(err);
|
|
37
62
|
exit(1);
|
|
38
63
|
});
|
|
39
|
-
|