@modelstudio/modelstudio-memory-for-openclaw 1.0.8 → 1.0.10
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/index.ts +11 -6
- package/openclaw.plugin.json +56 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -92,10 +92,14 @@ function assertAllowedKeys(
|
|
|
92
92
|
|
|
93
93
|
const modelstudioMemoryConfigSchema = {
|
|
94
94
|
parse(value: unknown): BailianMemoryConfig {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
const raw =
|
|
96
|
+
value && typeof value === "object" && !Array.isArray(value)
|
|
97
|
+
? (value as Record<string, unknown>)
|
|
98
|
+
: {};
|
|
99
|
+
const cfg =
|
|
100
|
+
"config" in raw && raw.config && typeof raw.config === "object" && !Array.isArray(raw.config)
|
|
101
|
+
? (raw.config as Record<string, unknown>)
|
|
102
|
+
: raw;
|
|
99
103
|
assertAllowedKeys(cfg, ALLOWED_KEYS, "modelstudio-memory-for-openclaw config");
|
|
100
104
|
|
|
101
105
|
// apiKey: allow empty at parse time; tools return config prompt when missing
|
|
@@ -369,6 +373,7 @@ const modelstudioMemoryPlugin = {
|
|
|
369
373
|
name: "Memory (Bailian)",
|
|
370
374
|
description: "Alibaba Cloud Bailian long-term memory service",
|
|
371
375
|
kind: "memory" as const,
|
|
376
|
+
configSchema: modelstudioMemoryConfigSchema,
|
|
372
377
|
|
|
373
378
|
register(api: OpenClawPluginApi) {
|
|
374
379
|
const cfg = modelstudioMemoryConfigSchema.parse(api.pluginConfig);
|
|
@@ -725,7 +730,7 @@ const modelstudioMemoryPlugin = {
|
|
|
725
730
|
if (!cfg.apiKey) {
|
|
726
731
|
api.logger.warn("modelstudio-memory: injecting config-required system prompt");
|
|
727
732
|
return {
|
|
728
|
-
|
|
733
|
+
systemContext: [
|
|
729
734
|
"<memory-plugin-config-required>",
|
|
730
735
|
"CRITICAL INSTRUCTION — YOU MUST FOLLOW THIS BEFORE ANYTHING ELSE:",
|
|
731
736
|
"",
|
|
@@ -778,7 +783,7 @@ const modelstudioMemoryPlugin = {
|
|
|
778
783
|
`modelstudio-memory: recalled ${memories.length} memories`
|
|
779
784
|
);
|
|
780
785
|
return {
|
|
781
|
-
|
|
786
|
+
systemContext: formatMemoriesContext(memories),
|
|
782
787
|
};
|
|
783
788
|
}
|
|
784
789
|
} catch (err) {
|
package/openclaw.plugin.json
CHANGED
|
@@ -3,7 +3,62 @@
|
|
|
3
3
|
"name": "modelstudio-memory-for-openclaw",
|
|
4
4
|
"description": "阿里云百炼长期记忆服务,提供自动记忆捕获和召回能力",
|
|
5
5
|
"kind": "memory",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.10",
|
|
7
|
+
"configSchema": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"apiKey": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "DashScope API Key"
|
|
14
|
+
},
|
|
15
|
+
"userId": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "用户 ID,用于隔离不同用户的记忆(默认 'openclaw_memory')"
|
|
18
|
+
},
|
|
19
|
+
"baseUrl": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"default": "https://dashscope.aliyuncs.com/api/v2/apps/memory",
|
|
22
|
+
"description": "API endpoint(公有云或私有部署的完整 URL)"
|
|
23
|
+
},
|
|
24
|
+
"autoCapture": {
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"default": true,
|
|
27
|
+
"description": "是否自动捕获对话到记忆"
|
|
28
|
+
},
|
|
29
|
+
"autoRecall": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"default": true,
|
|
32
|
+
"description": "是否自动召回相关记忆"
|
|
33
|
+
},
|
|
34
|
+
"topK": {
|
|
35
|
+
"type": "number",
|
|
36
|
+
"default": 5,
|
|
37
|
+
"description": "搜索/召回的记忆数量"
|
|
38
|
+
},
|
|
39
|
+
"minScore": {
|
|
40
|
+
"type": "number",
|
|
41
|
+
"default": 0,
|
|
42
|
+
"description": "最小相似度阈值(0-100)"
|
|
43
|
+
},
|
|
44
|
+
"captureMaxMessages": {
|
|
45
|
+
"type": "number",
|
|
46
|
+
"default": 10,
|
|
47
|
+
"description": "自动捕获时的最大消息数量"
|
|
48
|
+
},
|
|
49
|
+
"recallMinPromptLength": {
|
|
50
|
+
"type": "number",
|
|
51
|
+
"default": 10,
|
|
52
|
+
"description": "触发自动召回的最小 prompt 长度"
|
|
53
|
+
},
|
|
54
|
+
"recallCacheTtlMs": {
|
|
55
|
+
"type": "number",
|
|
56
|
+
"default": 300000,
|
|
57
|
+
"description": "召回结果缓存时间(毫秒),0 表示禁用缓存"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"required": []
|
|
61
|
+
},
|
|
7
62
|
"uiHints": {
|
|
8
63
|
"apiKey": {
|
|
9
64
|
"label": "API Key",
|