koishi-plugin-chatluna-long-memory 1.3.4 → 1.3.6
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/lib/index.cjs +171 -63
- package/lib/index.mjs +171 -63
- package/lib/plugins/add_memory.d.ts +0 -2
- package/lib/plugins/tool.d.ts +16 -16
- package/lib/utils/conversation.d.ts +14 -0
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -68,20 +68,41 @@ var import_logger = require("koishi-plugin-chatluna/utils/logger");
|
|
|
68
68
|
var import_koishi_plugin_chatluna = require("koishi-plugin-chatluna");
|
|
69
69
|
var import_chains = require("koishi-plugin-chatluna/chains");
|
|
70
70
|
var import_crypto = require("crypto");
|
|
71
|
+
|
|
72
|
+
// src/utils/conversation.ts
|
|
73
|
+
async function getMemoryScope(ctx, session, options) {
|
|
74
|
+
const resolved = await ctx.chatluna.conversation.resolveContext(session, {
|
|
75
|
+
conversationId: options.conversationId,
|
|
76
|
+
presetLane: options.presetLane
|
|
77
|
+
});
|
|
78
|
+
const conversation = resolved.conversation;
|
|
79
|
+
if (conversation == null) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
conversation,
|
|
84
|
+
preset: options.type ?? resolved.effectivePreset ?? conversation.preset,
|
|
85
|
+
info: {
|
|
86
|
+
presetId: options.type ?? resolved.effectivePreset ?? conversation.preset,
|
|
87
|
+
guildId: session.guildId || session.channelId,
|
|
88
|
+
userId: session.userId
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
__name(getMemoryScope, "getMemoryScope");
|
|
93
|
+
|
|
94
|
+
// src/plugins/add_memory.ts
|
|
71
95
|
function apply(ctx, config) {
|
|
72
96
|
const chain = ctx.chatluna.chatChain;
|
|
73
97
|
chain.middleware(
|
|
74
98
|
"add_memory",
|
|
75
99
|
async (session, context) => {
|
|
76
|
-
|
|
100
|
+
const {
|
|
77
101
|
command,
|
|
78
|
-
options: { type, content,
|
|
102
|
+
options: { type, content, view, conversationId, presetLane }
|
|
79
103
|
} = context;
|
|
80
104
|
if (command !== "add_memory")
|
|
81
105
|
return import_chains.ChainMiddlewareRunStatus.SKIPPED;
|
|
82
|
-
if (!type) {
|
|
83
|
-
type = room.preset;
|
|
84
|
-
}
|
|
85
106
|
let parsedLayerType = "user" /* USER */;
|
|
86
107
|
if (view != null) {
|
|
87
108
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -95,13 +116,18 @@ function apply(ctx, config) {
|
|
|
95
116
|
}
|
|
96
117
|
}
|
|
97
118
|
try {
|
|
119
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
120
|
+
conversationId,
|
|
121
|
+
presetLane,
|
|
122
|
+
type
|
|
123
|
+
});
|
|
124
|
+
if (scope == null) {
|
|
125
|
+
context.message = session.text(".add_failed");
|
|
126
|
+
return import_chains.ChainMiddlewareRunStatus.STOP;
|
|
127
|
+
}
|
|
98
128
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
guildId: session.guildId || session.channelId,
|
|
102
|
-
userId: session.userId
|
|
103
|
-
},
|
|
104
|
-
room.conversationId,
|
|
129
|
+
scope.info,
|
|
130
|
+
scope.conversation.id,
|
|
105
131
|
parsedLayerType
|
|
106
132
|
);
|
|
107
133
|
await Promise.all(
|
|
@@ -120,7 +146,7 @@ function apply(ctx, config) {
|
|
|
120
146
|
])
|
|
121
147
|
)
|
|
122
148
|
);
|
|
123
|
-
await ctx.chatluna.clearCache(
|
|
149
|
+
await ctx.chatluna.clearCache(scope.conversation);
|
|
124
150
|
context.message = session.text(".add_success");
|
|
125
151
|
} catch (error) {
|
|
126
152
|
import_koishi_plugin_chatluna.logger?.error(error);
|
|
@@ -1045,15 +1071,12 @@ function apply3(ctx, config) {
|
|
|
1045
1071
|
chain.middleware(
|
|
1046
1072
|
"clear_memory",
|
|
1047
1073
|
async (session, context) => {
|
|
1048
|
-
|
|
1074
|
+
const {
|
|
1049
1075
|
command,
|
|
1050
|
-
options: { type,
|
|
1076
|
+
options: { type, view, conversationId, presetLane }
|
|
1051
1077
|
} = context;
|
|
1052
1078
|
if (command !== "clear_memory")
|
|
1053
1079
|
return import_chains2.ChainMiddlewareRunStatus.SKIPPED;
|
|
1054
|
-
if (!type) {
|
|
1055
|
-
type = room.preset;
|
|
1056
|
-
}
|
|
1057
1080
|
let parsedLayerType = "user" /* USER */;
|
|
1058
1081
|
if (view != null) {
|
|
1059
1082
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -1067,19 +1090,24 @@ function apply3(ctx, config) {
|
|
|
1067
1090
|
}
|
|
1068
1091
|
}
|
|
1069
1092
|
try {
|
|
1093
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
1094
|
+
conversationId,
|
|
1095
|
+
presetLane,
|
|
1096
|
+
type
|
|
1097
|
+
});
|
|
1098
|
+
if (scope == null) {
|
|
1099
|
+
context.message = session.text(".clear_failed");
|
|
1100
|
+
return import_chains2.ChainMiddlewareRunStatus.STOP;
|
|
1101
|
+
}
|
|
1070
1102
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
guildId: session.guildId || session.channelId,
|
|
1074
|
-
userId: session.userId
|
|
1075
|
-
},
|
|
1076
|
-
room.conversationId,
|
|
1103
|
+
scope.info,
|
|
1104
|
+
scope.conversation.id,
|
|
1077
1105
|
parsedLayerType
|
|
1078
1106
|
);
|
|
1079
1107
|
await Promise.all(
|
|
1080
1108
|
layers.map((layer) => layer.clearMemories())
|
|
1081
1109
|
);
|
|
1082
|
-
await ctx.chatluna.clearCache(
|
|
1110
|
+
await ctx.chatluna.clearCache(scope.conversation);
|
|
1083
1111
|
context.message = session.text(".clear_success");
|
|
1084
1112
|
} catch (error) {
|
|
1085
1113
|
import_koishi_plugin_chatluna3.logger?.error(error);
|
|
@@ -1107,15 +1135,12 @@ function apply5(ctx, config) {
|
|
|
1107
1135
|
chain.middleware(
|
|
1108
1136
|
"delete_memory",
|
|
1109
1137
|
async (session, context) => {
|
|
1110
|
-
|
|
1138
|
+
const {
|
|
1111
1139
|
command,
|
|
1112
|
-
options: { type,
|
|
1140
|
+
options: { type, ids, view, conversationId, presetLane }
|
|
1113
1141
|
} = context;
|
|
1114
1142
|
if (command !== "delete_memory")
|
|
1115
1143
|
return import_chains3.ChainMiddlewareRunStatus.SKIPPED;
|
|
1116
|
-
if (!type) {
|
|
1117
|
-
type = room.preset;
|
|
1118
|
-
}
|
|
1119
1144
|
let parsedLayerType = "user" /* USER */;
|
|
1120
1145
|
if (view != null) {
|
|
1121
1146
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -1129,19 +1154,24 @@ function apply5(ctx, config) {
|
|
|
1129
1154
|
}
|
|
1130
1155
|
}
|
|
1131
1156
|
try {
|
|
1157
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
1158
|
+
conversationId,
|
|
1159
|
+
presetLane,
|
|
1160
|
+
type
|
|
1161
|
+
});
|
|
1162
|
+
if (scope == null) {
|
|
1163
|
+
context.message = session.text(".delete_failed");
|
|
1164
|
+
return import_chains3.ChainMiddlewareRunStatus.STOP;
|
|
1165
|
+
}
|
|
1132
1166
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
guildId: session.guildId || session.channelId,
|
|
1136
|
-
userId: session.userId
|
|
1137
|
-
},
|
|
1138
|
-
room.conversationId,
|
|
1167
|
+
scope.info,
|
|
1168
|
+
scope.conversation.id,
|
|
1139
1169
|
parsedLayerType
|
|
1140
1170
|
);
|
|
1141
1171
|
await Promise.all(
|
|
1142
1172
|
layers.map((layer) => layer.deleteMemories(ids))
|
|
1143
1173
|
);
|
|
1144
|
-
await ctx.chatluna.clearCache(
|
|
1174
|
+
await ctx.chatluna.clearCache(scope.conversation);
|
|
1145
1175
|
context.message = session.text(".delete_success");
|
|
1146
1176
|
} catch (error) {
|
|
1147
1177
|
import_koishi_plugin_chatluna4.logger?.error(error);
|
|
@@ -1162,15 +1192,18 @@ function apply6(ctx, config) {
|
|
|
1162
1192
|
chain.middleware(
|
|
1163
1193
|
"edit_memory",
|
|
1164
1194
|
async (session, context) => {
|
|
1165
|
-
|
|
1195
|
+
const {
|
|
1166
1196
|
command,
|
|
1167
|
-
options: {
|
|
1197
|
+
options: {
|
|
1198
|
+
type,
|
|
1199
|
+
memoryId,
|
|
1200
|
+
view,
|
|
1201
|
+
conversationId,
|
|
1202
|
+
presetLane
|
|
1203
|
+
}
|
|
1168
1204
|
} = context;
|
|
1169
1205
|
if (command !== "edit_memory")
|
|
1170
1206
|
return import_chains4.ChainMiddlewareRunStatus.SKIPPED;
|
|
1171
|
-
if (!type) {
|
|
1172
|
-
type = room.preset;
|
|
1173
|
-
}
|
|
1174
1207
|
let parsedLayerType = "user" /* USER */;
|
|
1175
1208
|
if (view != null) {
|
|
1176
1209
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -1185,16 +1218,25 @@ function apply6(ctx, config) {
|
|
|
1185
1218
|
}
|
|
1186
1219
|
try {
|
|
1187
1220
|
await session.send(session.text(".edit_memory_start"));
|
|
1221
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
1222
|
+
conversationId,
|
|
1223
|
+
presetLane,
|
|
1224
|
+
type
|
|
1225
|
+
});
|
|
1226
|
+
if (scope == null) {
|
|
1227
|
+
context.message = session.text(".edit_failed");
|
|
1228
|
+
return import_chains4.ChainMiddlewareRunStatus.STOP;
|
|
1229
|
+
}
|
|
1188
1230
|
const content = await session.prompt();
|
|
1189
1231
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
1190
1232
|
{
|
|
1191
|
-
|
|
1233
|
+
...scope.info,
|
|
1192
1234
|
userId: session.userId,
|
|
1193
1235
|
guildId: session.guildId || session.channelId,
|
|
1194
1236
|
type: parsedLayerType,
|
|
1195
1237
|
memoryId
|
|
1196
1238
|
},
|
|
1197
|
-
|
|
1239
|
+
scope.conversation.id,
|
|
1198
1240
|
parsedLayerType
|
|
1199
1241
|
);
|
|
1200
1242
|
await Promise.all(
|
|
@@ -1208,7 +1250,7 @@ function apply6(ctx, config) {
|
|
|
1208
1250
|
await Promise.all(
|
|
1209
1251
|
layers.map((layer) => layer.addMemories([memory]))
|
|
1210
1252
|
);
|
|
1211
|
-
await ctx.chatluna.clearCache(
|
|
1253
|
+
await ctx.chatluna.clearCache(scope.conversation);
|
|
1212
1254
|
context.message = session.text(".edit_success");
|
|
1213
1255
|
} catch (error) {
|
|
1214
1256
|
import_koishi_plugin_chatluna5.logger?.error(error);
|
|
@@ -2854,16 +2896,21 @@ function apply9(ctx, config) {
|
|
|
2854
2896
|
chain.middleware(
|
|
2855
2897
|
"search_memory",
|
|
2856
2898
|
async (session, context) => {
|
|
2857
|
-
|
|
2899
|
+
const {
|
|
2858
2900
|
command,
|
|
2859
|
-
options: {
|
|
2901
|
+
options: {
|
|
2902
|
+
page,
|
|
2903
|
+
limit,
|
|
2904
|
+
query,
|
|
2905
|
+
type,
|
|
2906
|
+
view,
|
|
2907
|
+
conversationId,
|
|
2908
|
+
presetLane
|
|
2909
|
+
}
|
|
2860
2910
|
} = context;
|
|
2861
2911
|
if (command !== "search_memory") {
|
|
2862
2912
|
return import_chains5.ChainMiddlewareRunStatus.SKIPPED;
|
|
2863
2913
|
}
|
|
2864
|
-
if (!type) {
|
|
2865
|
-
type = room.preset;
|
|
2866
|
-
}
|
|
2867
2914
|
let parsedLayerType = "user" /* USER */;
|
|
2868
2915
|
if (view != null) {
|
|
2869
2916
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -2887,19 +2934,24 @@ function apply9(ctx, config) {
|
|
|
2887
2934
|
pagination.updateFormatItem(
|
|
2888
2935
|
(value) => formatDocumentInfo(session, value)
|
|
2889
2936
|
);
|
|
2890
|
-
|
|
2937
|
+
const content = query ?? " ";
|
|
2891
2938
|
try {
|
|
2939
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
2940
|
+
conversationId,
|
|
2941
|
+
presetLane,
|
|
2942
|
+
type
|
|
2943
|
+
});
|
|
2944
|
+
if (scope == null) {
|
|
2945
|
+
context.message = session.text(".search_failed");
|
|
2946
|
+
return import_chains5.ChainMiddlewareRunStatus.STOP;
|
|
2947
|
+
}
|
|
2892
2948
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
guildId: session.guildId || session.channelId,
|
|
2896
|
-
userId: session.userId
|
|
2897
|
-
},
|
|
2898
|
-
room.conversationId,
|
|
2949
|
+
scope.info,
|
|
2950
|
+
scope.conversation.id,
|
|
2899
2951
|
parsedLayerType
|
|
2900
2952
|
);
|
|
2901
2953
|
const documents = await Promise.all(
|
|
2902
|
-
layers.map((layer) => layer.retrieveMemory(
|
|
2954
|
+
layers.map((layer) => layer.retrieveMemory(content))
|
|
2903
2955
|
).then((documents2) => documents2.flat());
|
|
2904
2956
|
await pagination.push(documents);
|
|
2905
2957
|
context.message = await pagination.getFormattedPage(
|
|
@@ -2951,6 +3003,17 @@ async function apply10(ctx, config, plugin) {
|
|
|
2951
3003
|
selector(history) {
|
|
2952
3004
|
return true;
|
|
2953
3005
|
},
|
|
3006
|
+
meta: {
|
|
3007
|
+
source: "extension",
|
|
3008
|
+
group: "long-memory",
|
|
3009
|
+
tags: ["long-memory", "search"],
|
|
3010
|
+
defaultAvailability: {
|
|
3011
|
+
enabled: true,
|
|
3012
|
+
main: true,
|
|
3013
|
+
chatluna: true,
|
|
3014
|
+
characterScope: "none"
|
|
3015
|
+
}
|
|
3016
|
+
},
|
|
2954
3017
|
createTool(params2) {
|
|
2955
3018
|
return new MemorySearchTool(ctx, params2);
|
|
2956
3019
|
}
|
|
@@ -2960,6 +3023,17 @@ async function apply10(ctx, config, plugin) {
|
|
|
2960
3023
|
selector(history) {
|
|
2961
3024
|
return true;
|
|
2962
3025
|
},
|
|
3026
|
+
meta: {
|
|
3027
|
+
source: "extension",
|
|
3028
|
+
group: "long-memory",
|
|
3029
|
+
tags: ["long-memory", "add"],
|
|
3030
|
+
defaultAvailability: {
|
|
3031
|
+
enabled: true,
|
|
3032
|
+
main: true,
|
|
3033
|
+
chatluna: true,
|
|
3034
|
+
characterScope: "all"
|
|
3035
|
+
}
|
|
3036
|
+
},
|
|
2963
3037
|
createTool(params2) {
|
|
2964
3038
|
return new MemoryAddTool(ctx, params2);
|
|
2965
3039
|
}
|
|
@@ -2969,6 +3043,17 @@ async function apply10(ctx, config, plugin) {
|
|
|
2969
3043
|
selector(history) {
|
|
2970
3044
|
return true;
|
|
2971
3045
|
},
|
|
3046
|
+
meta: {
|
|
3047
|
+
source: "extension",
|
|
3048
|
+
group: "long-memory",
|
|
3049
|
+
tags: ["long-memory", "delete"],
|
|
3050
|
+
defaultAvailability: {
|
|
3051
|
+
enabled: true,
|
|
3052
|
+
main: true,
|
|
3053
|
+
chatluna: true,
|
|
3054
|
+
characterScope: "all"
|
|
3055
|
+
}
|
|
3056
|
+
},
|
|
2972
3057
|
createTool(params2) {
|
|
2973
3058
|
return new MemoryDeleteTool(ctx, params2);
|
|
2974
3059
|
}
|
|
@@ -2978,6 +3063,17 @@ async function apply10(ctx, config, plugin) {
|
|
|
2978
3063
|
selector(history) {
|
|
2979
3064
|
return true;
|
|
2980
3065
|
},
|
|
3066
|
+
meta: {
|
|
3067
|
+
source: "extension",
|
|
3068
|
+
group: "long-memory",
|
|
3069
|
+
tags: ["long-memory", "update"],
|
|
3070
|
+
defaultAvailability: {
|
|
3071
|
+
enabled: true,
|
|
3072
|
+
main: true,
|
|
3073
|
+
chatluna: true,
|
|
3074
|
+
characterScope: "all"
|
|
3075
|
+
}
|
|
3076
|
+
},
|
|
2981
3077
|
createTool(params2) {
|
|
2982
3078
|
return new MemoryUpdateTool(ctx, params2);
|
|
2983
3079
|
}
|
|
@@ -3310,12 +3406,24 @@ var ChatLunaLongMemoryService = class extends import_koishi.Service {
|
|
|
3310
3406
|
(layer) => MemoryRetrievalLayerType[layer.toUpperCase()]
|
|
3311
3407
|
).filter((v) => v != null);
|
|
3312
3408
|
this.defaultLayerTypes.push(...mapped);
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
);
|
|
3409
|
+
const clear = /* @__PURE__ */ __name((conversationId) => {
|
|
3410
|
+
delete this._memoryLayerNamespaces[conversationId];
|
|
3411
|
+
}, "clear");
|
|
3412
|
+
ctx.on("chatluna/conversation-after-clear-history", async (payload) => {
|
|
3413
|
+
clear(payload.conversation.id);
|
|
3414
|
+
});
|
|
3415
|
+
ctx.on("chatluna/conversation-after-cache-clear", async (payload) => {
|
|
3416
|
+
clear(payload.conversation.id);
|
|
3417
|
+
});
|
|
3418
|
+
ctx.on("chatluna/conversation-after-archive", async (payload) => {
|
|
3419
|
+
clear(payload.conversation.id);
|
|
3420
|
+
});
|
|
3421
|
+
ctx.on("chatluna/conversation-after-restore", async (payload) => {
|
|
3422
|
+
clear(payload.conversation.id);
|
|
3423
|
+
});
|
|
3424
|
+
ctx.on("chatluna/conversation-after-delete", async (payload) => {
|
|
3425
|
+
clear(payload.conversation.id);
|
|
3426
|
+
});
|
|
3319
3427
|
ctx.setInterval(
|
|
3320
3428
|
async () => {
|
|
3321
3429
|
for (const [, layers] of Object.entries(
|
package/lib/index.mjs
CHANGED
|
@@ -28,20 +28,41 @@ import { createLogger } from "koishi-plugin-chatluna/utils/logger";
|
|
|
28
28
|
import { logger } from "koishi-plugin-chatluna";
|
|
29
29
|
import { ChainMiddlewareRunStatus } from "koishi-plugin-chatluna/chains";
|
|
30
30
|
import { randomUUID } from "crypto";
|
|
31
|
+
|
|
32
|
+
// src/utils/conversation.ts
|
|
33
|
+
async function getMemoryScope(ctx, session, options) {
|
|
34
|
+
const resolved = await ctx.chatluna.conversation.resolveContext(session, {
|
|
35
|
+
conversationId: options.conversationId,
|
|
36
|
+
presetLane: options.presetLane
|
|
37
|
+
});
|
|
38
|
+
const conversation = resolved.conversation;
|
|
39
|
+
if (conversation == null) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
conversation,
|
|
44
|
+
preset: options.type ?? resolved.effectivePreset ?? conversation.preset,
|
|
45
|
+
info: {
|
|
46
|
+
presetId: options.type ?? resolved.effectivePreset ?? conversation.preset,
|
|
47
|
+
guildId: session.guildId || session.channelId,
|
|
48
|
+
userId: session.userId
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
__name(getMemoryScope, "getMemoryScope");
|
|
53
|
+
|
|
54
|
+
// src/plugins/add_memory.ts
|
|
31
55
|
function apply(ctx, config) {
|
|
32
56
|
const chain = ctx.chatluna.chatChain;
|
|
33
57
|
chain.middleware(
|
|
34
58
|
"add_memory",
|
|
35
59
|
async (session, context) => {
|
|
36
|
-
|
|
60
|
+
const {
|
|
37
61
|
command,
|
|
38
|
-
options: { type, content,
|
|
62
|
+
options: { type, content, view, conversationId, presetLane }
|
|
39
63
|
} = context;
|
|
40
64
|
if (command !== "add_memory")
|
|
41
65
|
return ChainMiddlewareRunStatus.SKIPPED;
|
|
42
|
-
if (!type) {
|
|
43
|
-
type = room.preset;
|
|
44
|
-
}
|
|
45
66
|
let parsedLayerType = "user" /* USER */;
|
|
46
67
|
if (view != null) {
|
|
47
68
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -55,13 +76,18 @@ function apply(ctx, config) {
|
|
|
55
76
|
}
|
|
56
77
|
}
|
|
57
78
|
try {
|
|
79
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
80
|
+
conversationId,
|
|
81
|
+
presetLane,
|
|
82
|
+
type
|
|
83
|
+
});
|
|
84
|
+
if (scope == null) {
|
|
85
|
+
context.message = session.text(".add_failed");
|
|
86
|
+
return ChainMiddlewareRunStatus.STOP;
|
|
87
|
+
}
|
|
58
88
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
guildId: session.guildId || session.channelId,
|
|
62
|
-
userId: session.userId
|
|
63
|
-
},
|
|
64
|
-
room.conversationId,
|
|
89
|
+
scope.info,
|
|
90
|
+
scope.conversation.id,
|
|
65
91
|
parsedLayerType
|
|
66
92
|
);
|
|
67
93
|
await Promise.all(
|
|
@@ -80,7 +106,7 @@ function apply(ctx, config) {
|
|
|
80
106
|
])
|
|
81
107
|
)
|
|
82
108
|
);
|
|
83
|
-
await ctx.chatluna.clearCache(
|
|
109
|
+
await ctx.chatluna.clearCache(scope.conversation);
|
|
84
110
|
context.message = session.text(".add_success");
|
|
85
111
|
} catch (error) {
|
|
86
112
|
logger?.error(error);
|
|
@@ -1008,15 +1034,12 @@ function apply3(ctx, config) {
|
|
|
1008
1034
|
chain.middleware(
|
|
1009
1035
|
"clear_memory",
|
|
1010
1036
|
async (session, context) => {
|
|
1011
|
-
|
|
1037
|
+
const {
|
|
1012
1038
|
command,
|
|
1013
|
-
options: { type,
|
|
1039
|
+
options: { type, view, conversationId, presetLane }
|
|
1014
1040
|
} = context;
|
|
1015
1041
|
if (command !== "clear_memory")
|
|
1016
1042
|
return ChainMiddlewareRunStatus2.SKIPPED;
|
|
1017
|
-
if (!type) {
|
|
1018
|
-
type = room.preset;
|
|
1019
|
-
}
|
|
1020
1043
|
let parsedLayerType = "user" /* USER */;
|
|
1021
1044
|
if (view != null) {
|
|
1022
1045
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -1030,19 +1053,24 @@ function apply3(ctx, config) {
|
|
|
1030
1053
|
}
|
|
1031
1054
|
}
|
|
1032
1055
|
try {
|
|
1056
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
1057
|
+
conversationId,
|
|
1058
|
+
presetLane,
|
|
1059
|
+
type
|
|
1060
|
+
});
|
|
1061
|
+
if (scope == null) {
|
|
1062
|
+
context.message = session.text(".clear_failed");
|
|
1063
|
+
return ChainMiddlewareRunStatus2.STOP;
|
|
1064
|
+
}
|
|
1033
1065
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
guildId: session.guildId || session.channelId,
|
|
1037
|
-
userId: session.userId
|
|
1038
|
-
},
|
|
1039
|
-
room.conversationId,
|
|
1066
|
+
scope.info,
|
|
1067
|
+
scope.conversation.id,
|
|
1040
1068
|
parsedLayerType
|
|
1041
1069
|
);
|
|
1042
1070
|
await Promise.all(
|
|
1043
1071
|
layers.map((layer) => layer.clearMemories())
|
|
1044
1072
|
);
|
|
1045
|
-
await ctx.chatluna.clearCache(
|
|
1073
|
+
await ctx.chatluna.clearCache(scope.conversation);
|
|
1046
1074
|
context.message = session.text(".clear_success");
|
|
1047
1075
|
} catch (error) {
|
|
1048
1076
|
logger5?.error(error);
|
|
@@ -1070,15 +1098,12 @@ function apply5(ctx, config) {
|
|
|
1070
1098
|
chain.middleware(
|
|
1071
1099
|
"delete_memory",
|
|
1072
1100
|
async (session, context) => {
|
|
1073
|
-
|
|
1101
|
+
const {
|
|
1074
1102
|
command,
|
|
1075
|
-
options: { type,
|
|
1103
|
+
options: { type, ids, view, conversationId, presetLane }
|
|
1076
1104
|
} = context;
|
|
1077
1105
|
if (command !== "delete_memory")
|
|
1078
1106
|
return ChainMiddlewareRunStatus3.SKIPPED;
|
|
1079
|
-
if (!type) {
|
|
1080
|
-
type = room.preset;
|
|
1081
|
-
}
|
|
1082
1107
|
let parsedLayerType = "user" /* USER */;
|
|
1083
1108
|
if (view != null) {
|
|
1084
1109
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -1092,19 +1117,24 @@ function apply5(ctx, config) {
|
|
|
1092
1117
|
}
|
|
1093
1118
|
}
|
|
1094
1119
|
try {
|
|
1120
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
1121
|
+
conversationId,
|
|
1122
|
+
presetLane,
|
|
1123
|
+
type
|
|
1124
|
+
});
|
|
1125
|
+
if (scope == null) {
|
|
1126
|
+
context.message = session.text(".delete_failed");
|
|
1127
|
+
return ChainMiddlewareRunStatus3.STOP;
|
|
1128
|
+
}
|
|
1095
1129
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
guildId: session.guildId || session.channelId,
|
|
1099
|
-
userId: session.userId
|
|
1100
|
-
},
|
|
1101
|
-
room.conversationId,
|
|
1130
|
+
scope.info,
|
|
1131
|
+
scope.conversation.id,
|
|
1102
1132
|
parsedLayerType
|
|
1103
1133
|
);
|
|
1104
1134
|
await Promise.all(
|
|
1105
1135
|
layers.map((layer) => layer.deleteMemories(ids))
|
|
1106
1136
|
);
|
|
1107
|
-
await ctx.chatluna.clearCache(
|
|
1137
|
+
await ctx.chatluna.clearCache(scope.conversation);
|
|
1108
1138
|
context.message = session.text(".delete_success");
|
|
1109
1139
|
} catch (error) {
|
|
1110
1140
|
logger6?.error(error);
|
|
@@ -1125,15 +1155,18 @@ function apply6(ctx, config) {
|
|
|
1125
1155
|
chain.middleware(
|
|
1126
1156
|
"edit_memory",
|
|
1127
1157
|
async (session, context) => {
|
|
1128
|
-
|
|
1158
|
+
const {
|
|
1129
1159
|
command,
|
|
1130
|
-
options: {
|
|
1160
|
+
options: {
|
|
1161
|
+
type,
|
|
1162
|
+
memoryId,
|
|
1163
|
+
view,
|
|
1164
|
+
conversationId,
|
|
1165
|
+
presetLane
|
|
1166
|
+
}
|
|
1131
1167
|
} = context;
|
|
1132
1168
|
if (command !== "edit_memory")
|
|
1133
1169
|
return ChainMiddlewareRunStatus4.SKIPPED;
|
|
1134
|
-
if (!type) {
|
|
1135
|
-
type = room.preset;
|
|
1136
|
-
}
|
|
1137
1170
|
let parsedLayerType = "user" /* USER */;
|
|
1138
1171
|
if (view != null) {
|
|
1139
1172
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -1148,16 +1181,25 @@ function apply6(ctx, config) {
|
|
|
1148
1181
|
}
|
|
1149
1182
|
try {
|
|
1150
1183
|
await session.send(session.text(".edit_memory_start"));
|
|
1184
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
1185
|
+
conversationId,
|
|
1186
|
+
presetLane,
|
|
1187
|
+
type
|
|
1188
|
+
});
|
|
1189
|
+
if (scope == null) {
|
|
1190
|
+
context.message = session.text(".edit_failed");
|
|
1191
|
+
return ChainMiddlewareRunStatus4.STOP;
|
|
1192
|
+
}
|
|
1151
1193
|
const content = await session.prompt();
|
|
1152
1194
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
1153
1195
|
{
|
|
1154
|
-
|
|
1196
|
+
...scope.info,
|
|
1155
1197
|
userId: session.userId,
|
|
1156
1198
|
guildId: session.guildId || session.channelId,
|
|
1157
1199
|
type: parsedLayerType,
|
|
1158
1200
|
memoryId
|
|
1159
1201
|
},
|
|
1160
|
-
|
|
1202
|
+
scope.conversation.id,
|
|
1161
1203
|
parsedLayerType
|
|
1162
1204
|
);
|
|
1163
1205
|
await Promise.all(
|
|
@@ -1171,7 +1213,7 @@ function apply6(ctx, config) {
|
|
|
1171
1213
|
await Promise.all(
|
|
1172
1214
|
layers.map((layer) => layer.addMemories([memory]))
|
|
1173
1215
|
);
|
|
1174
|
-
await ctx.chatluna.clearCache(
|
|
1216
|
+
await ctx.chatluna.clearCache(scope.conversation);
|
|
1175
1217
|
context.message = session.text(".edit_success");
|
|
1176
1218
|
} catch (error) {
|
|
1177
1219
|
logger7?.error(error);
|
|
@@ -2817,16 +2859,21 @@ function apply9(ctx, config) {
|
|
|
2817
2859
|
chain.middleware(
|
|
2818
2860
|
"search_memory",
|
|
2819
2861
|
async (session, context) => {
|
|
2820
|
-
|
|
2862
|
+
const {
|
|
2821
2863
|
command,
|
|
2822
|
-
options: {
|
|
2864
|
+
options: {
|
|
2865
|
+
page,
|
|
2866
|
+
limit,
|
|
2867
|
+
query,
|
|
2868
|
+
type,
|
|
2869
|
+
view,
|
|
2870
|
+
conversationId,
|
|
2871
|
+
presetLane
|
|
2872
|
+
}
|
|
2823
2873
|
} = context;
|
|
2824
2874
|
if (command !== "search_memory") {
|
|
2825
2875
|
return ChainMiddlewareRunStatus5.SKIPPED;
|
|
2826
2876
|
}
|
|
2827
|
-
if (!type) {
|
|
2828
|
-
type = room.preset;
|
|
2829
|
-
}
|
|
2830
2877
|
let parsedLayerType = "user" /* USER */;
|
|
2831
2878
|
if (view != null) {
|
|
2832
2879
|
parsedLayerType = MemoryRetrievalLayerType[view.toUpperCase()];
|
|
@@ -2850,19 +2897,24 @@ function apply9(ctx, config) {
|
|
|
2850
2897
|
pagination.updateFormatItem(
|
|
2851
2898
|
(value) => formatDocumentInfo(session, value)
|
|
2852
2899
|
);
|
|
2853
|
-
|
|
2900
|
+
const content = query ?? " ";
|
|
2854
2901
|
try {
|
|
2902
|
+
const scope = await getMemoryScope(ctx, session, {
|
|
2903
|
+
conversationId,
|
|
2904
|
+
presetLane,
|
|
2905
|
+
type
|
|
2906
|
+
});
|
|
2907
|
+
if (scope == null) {
|
|
2908
|
+
context.message = session.text(".search_failed");
|
|
2909
|
+
return ChainMiddlewareRunStatus5.STOP;
|
|
2910
|
+
}
|
|
2855
2911
|
const layers = await ctx.chatluna_long_memory.initMemoryLayers(
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
guildId: session.guildId || session.channelId,
|
|
2859
|
-
userId: session.userId
|
|
2860
|
-
},
|
|
2861
|
-
room.conversationId,
|
|
2912
|
+
scope.info,
|
|
2913
|
+
scope.conversation.id,
|
|
2862
2914
|
parsedLayerType
|
|
2863
2915
|
);
|
|
2864
2916
|
const documents = await Promise.all(
|
|
2865
|
-
layers.map((layer) => layer.retrieveMemory(
|
|
2917
|
+
layers.map((layer) => layer.retrieveMemory(content))
|
|
2866
2918
|
).then((documents2) => documents2.flat());
|
|
2867
2919
|
await pagination.push(documents);
|
|
2868
2920
|
context.message = await pagination.getFormattedPage(
|
|
@@ -2914,6 +2966,17 @@ async function apply10(ctx, config, plugin) {
|
|
|
2914
2966
|
selector(history) {
|
|
2915
2967
|
return true;
|
|
2916
2968
|
},
|
|
2969
|
+
meta: {
|
|
2970
|
+
source: "extension",
|
|
2971
|
+
group: "long-memory",
|
|
2972
|
+
tags: ["long-memory", "search"],
|
|
2973
|
+
defaultAvailability: {
|
|
2974
|
+
enabled: true,
|
|
2975
|
+
main: true,
|
|
2976
|
+
chatluna: true,
|
|
2977
|
+
characterScope: "none"
|
|
2978
|
+
}
|
|
2979
|
+
},
|
|
2917
2980
|
createTool(params2) {
|
|
2918
2981
|
return new MemorySearchTool(ctx, params2);
|
|
2919
2982
|
}
|
|
@@ -2923,6 +2986,17 @@ async function apply10(ctx, config, plugin) {
|
|
|
2923
2986
|
selector(history) {
|
|
2924
2987
|
return true;
|
|
2925
2988
|
},
|
|
2989
|
+
meta: {
|
|
2990
|
+
source: "extension",
|
|
2991
|
+
group: "long-memory",
|
|
2992
|
+
tags: ["long-memory", "add"],
|
|
2993
|
+
defaultAvailability: {
|
|
2994
|
+
enabled: true,
|
|
2995
|
+
main: true,
|
|
2996
|
+
chatluna: true,
|
|
2997
|
+
characterScope: "all"
|
|
2998
|
+
}
|
|
2999
|
+
},
|
|
2926
3000
|
createTool(params2) {
|
|
2927
3001
|
return new MemoryAddTool(ctx, params2);
|
|
2928
3002
|
}
|
|
@@ -2932,6 +3006,17 @@ async function apply10(ctx, config, plugin) {
|
|
|
2932
3006
|
selector(history) {
|
|
2933
3007
|
return true;
|
|
2934
3008
|
},
|
|
3009
|
+
meta: {
|
|
3010
|
+
source: "extension",
|
|
3011
|
+
group: "long-memory",
|
|
3012
|
+
tags: ["long-memory", "delete"],
|
|
3013
|
+
defaultAvailability: {
|
|
3014
|
+
enabled: true,
|
|
3015
|
+
main: true,
|
|
3016
|
+
chatluna: true,
|
|
3017
|
+
characterScope: "all"
|
|
3018
|
+
}
|
|
3019
|
+
},
|
|
2935
3020
|
createTool(params2) {
|
|
2936
3021
|
return new MemoryDeleteTool(ctx, params2);
|
|
2937
3022
|
}
|
|
@@ -2941,6 +3026,17 @@ async function apply10(ctx, config, plugin) {
|
|
|
2941
3026
|
selector(history) {
|
|
2942
3027
|
return true;
|
|
2943
3028
|
},
|
|
3029
|
+
meta: {
|
|
3030
|
+
source: "extension",
|
|
3031
|
+
group: "long-memory",
|
|
3032
|
+
tags: ["long-memory", "update"],
|
|
3033
|
+
defaultAvailability: {
|
|
3034
|
+
enabled: true,
|
|
3035
|
+
main: true,
|
|
3036
|
+
chatluna: true,
|
|
3037
|
+
characterScope: "all"
|
|
3038
|
+
}
|
|
3039
|
+
},
|
|
2944
3040
|
createTool(params2) {
|
|
2945
3041
|
return new MemoryUpdateTool(ctx, params2);
|
|
2946
3042
|
}
|
|
@@ -3273,12 +3369,24 @@ var ChatLunaLongMemoryService = class extends Service {
|
|
|
3273
3369
|
(layer) => MemoryRetrievalLayerType[layer.toUpperCase()]
|
|
3274
3370
|
).filter((v) => v != null);
|
|
3275
3371
|
this.defaultLayerTypes.push(...mapped);
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
);
|
|
3372
|
+
const clear = /* @__PURE__ */ __name((conversationId) => {
|
|
3373
|
+
delete this._memoryLayerNamespaces[conversationId];
|
|
3374
|
+
}, "clear");
|
|
3375
|
+
ctx.on("chatluna/conversation-after-clear-history", async (payload) => {
|
|
3376
|
+
clear(payload.conversation.id);
|
|
3377
|
+
});
|
|
3378
|
+
ctx.on("chatluna/conversation-after-cache-clear", async (payload) => {
|
|
3379
|
+
clear(payload.conversation.id);
|
|
3380
|
+
});
|
|
3381
|
+
ctx.on("chatluna/conversation-after-archive", async (payload) => {
|
|
3382
|
+
clear(payload.conversation.id);
|
|
3383
|
+
});
|
|
3384
|
+
ctx.on("chatluna/conversation-after-restore", async (payload) => {
|
|
3385
|
+
clear(payload.conversation.id);
|
|
3386
|
+
});
|
|
3387
|
+
ctx.on("chatluna/conversation-after-delete", async (payload) => {
|
|
3388
|
+
clear(payload.conversation.id);
|
|
3389
|
+
});
|
|
3282
3390
|
ctx.setInterval(
|
|
3283
3391
|
async () => {
|
|
3284
3392
|
for (const [, layers] of Object.entries(
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Context } from 'koishi';
|
|
2
|
-
import { ConversationRoom } from 'koishi-plugin-chatluna';
|
|
3
2
|
import { Config } from '../index';
|
|
4
3
|
export declare function apply(ctx: Context, config: Config): void;
|
|
5
4
|
declare module 'koishi-plugin-chatluna/chains' {
|
|
@@ -8,6 +7,5 @@ declare module 'koishi-plugin-chatluna/chains' {
|
|
|
8
7
|
}
|
|
9
8
|
interface ChainMiddlewareContextOptions {
|
|
10
9
|
content?: string;
|
|
11
|
-
room?: ConversationRoom;
|
|
12
10
|
}
|
|
13
11
|
}
|
package/lib/plugins/tool.d.ts
CHANGED
|
@@ -15,10 +15,10 @@ export declare class MemorySearchTool extends StructuredTool {
|
|
|
15
15
|
layer: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"preset">, z.ZodLiteral<"guild">, z.ZodLiteral<"global">]>, "many">;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
17
|
content?: string;
|
|
18
|
-
layer?: ("
|
|
18
|
+
layer?: ("user" | "preset" | "guild" | "global")[];
|
|
19
19
|
}, {
|
|
20
20
|
content?: string;
|
|
21
|
-
layer?: ("
|
|
21
|
+
layer?: ("user" | "preset" | "guild" | "global")[];
|
|
22
22
|
}>;
|
|
23
23
|
constructor(ctx: Context, params: CreateToolParams);
|
|
24
24
|
/** @ignore */
|
|
@@ -35,27 +35,27 @@ export declare class MemoryAddTool extends StructuredTool {
|
|
|
35
35
|
type: z.ZodNativeEnum<typeof MemoryType>;
|
|
36
36
|
importance: z.ZodNumber;
|
|
37
37
|
}, "strip", z.ZodTypeAny, {
|
|
38
|
-
type?: MemoryType;
|
|
39
38
|
content?: string;
|
|
39
|
+
type?: MemoryType;
|
|
40
40
|
importance?: number;
|
|
41
41
|
}, {
|
|
42
|
-
type?: MemoryType;
|
|
43
42
|
content?: string;
|
|
43
|
+
type?: MemoryType;
|
|
44
44
|
importance?: number;
|
|
45
45
|
}>, "many">;
|
|
46
46
|
layer: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"preset">, z.ZodLiteral<"guild">, z.ZodLiteral<"global">]>, "many">;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
|
-
layer?: ("
|
|
48
|
+
layer?: ("user" | "preset" | "guild" | "global")[];
|
|
49
49
|
memories?: {
|
|
50
|
-
type?: MemoryType;
|
|
51
50
|
content?: string;
|
|
51
|
+
type?: MemoryType;
|
|
52
52
|
importance?: number;
|
|
53
53
|
}[];
|
|
54
54
|
}, {
|
|
55
|
-
layer?: ("
|
|
55
|
+
layer?: ("user" | "preset" | "guild" | "global")[];
|
|
56
56
|
memories?: {
|
|
57
|
-
type?: MemoryType;
|
|
58
57
|
content?: string;
|
|
58
|
+
type?: MemoryType;
|
|
59
59
|
importance?: number;
|
|
60
60
|
}[];
|
|
61
61
|
}>;
|
|
@@ -72,10 +72,10 @@ export declare class MemoryDeleteTool extends StructuredTool {
|
|
|
72
72
|
memoryIds: z.ZodArray<z.ZodString, "many">;
|
|
73
73
|
layer: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"preset">, z.ZodLiteral<"guild">, z.ZodLiteral<"global">]>, "many">;
|
|
74
74
|
}, "strip", z.ZodTypeAny, {
|
|
75
|
-
layer?: ("
|
|
75
|
+
layer?: ("user" | "preset" | "guild" | "global")[];
|
|
76
76
|
memoryIds?: string[];
|
|
77
77
|
}, {
|
|
78
|
-
layer?: ("
|
|
78
|
+
layer?: ("user" | "preset" | "guild" | "global")[];
|
|
79
79
|
memoryIds?: string[];
|
|
80
80
|
}>;
|
|
81
81
|
constructor(ctx: Context, params: CreateToolParams);
|
|
@@ -94,29 +94,29 @@ export declare class MemoryUpdateTool extends StructuredTool {
|
|
|
94
94
|
type: z.ZodNativeEnum<typeof MemoryType>;
|
|
95
95
|
importance: z.ZodNumber;
|
|
96
96
|
}, "strip", z.ZodTypeAny, {
|
|
97
|
-
type?: MemoryType;
|
|
98
97
|
content?: string;
|
|
98
|
+
type?: MemoryType;
|
|
99
99
|
importance?: number;
|
|
100
100
|
}, {
|
|
101
|
-
type?: MemoryType;
|
|
102
101
|
content?: string;
|
|
102
|
+
type?: MemoryType;
|
|
103
103
|
importance?: number;
|
|
104
104
|
}>, "many">;
|
|
105
105
|
layer: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"preset">, z.ZodLiteral<"guild">, z.ZodLiteral<"global">]>, "many">;
|
|
106
106
|
}, "strip", z.ZodTypeAny, {
|
|
107
|
-
layer?: ("
|
|
107
|
+
layer?: ("user" | "preset" | "guild" | "global")[];
|
|
108
108
|
memoryIds?: string[];
|
|
109
109
|
newMemories?: {
|
|
110
|
-
type?: MemoryType;
|
|
111
110
|
content?: string;
|
|
111
|
+
type?: MemoryType;
|
|
112
112
|
importance?: number;
|
|
113
113
|
}[];
|
|
114
114
|
}, {
|
|
115
|
-
layer?: ("
|
|
115
|
+
layer?: ("user" | "preset" | "guild" | "global")[];
|
|
116
116
|
memoryIds?: string[];
|
|
117
117
|
newMemories?: {
|
|
118
|
-
type?: MemoryType;
|
|
119
118
|
content?: string;
|
|
119
|
+
type?: MemoryType;
|
|
120
120
|
importance?: number;
|
|
121
121
|
}[];
|
|
122
122
|
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Context, Session } from 'koishi';
|
|
2
|
+
export declare function getMemoryScope(ctx: Context, session: Session, options: {
|
|
3
|
+
conversationId?: string;
|
|
4
|
+
presetLane?: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
conversation: Parameters<Context['chatluna']['clearCache']>[0];
|
|
8
|
+
preset: string;
|
|
9
|
+
info: {
|
|
10
|
+
presetId: string;
|
|
11
|
+
guildId: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
};
|
|
14
|
+
} | null>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-chatluna-long-memory",
|
|
3
3
|
"description": "long memory for chatluna",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.6",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
7
7
|
"typings": "lib/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"koishi": "^4.18.9",
|
|
65
|
-
"koishi-plugin-chatluna": "^1.
|
|
65
|
+
"koishi-plugin-chatluna": "^1.4.0-alpha.0"
|
|
66
66
|
},
|
|
67
67
|
"resolutions": {
|
|
68
68
|
"@langchain/core": "^0.3.80",
|