koishi-plugin-chatluna 1.2.0-alpha.8 → 1.2.0

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.
@@ -154,7 +154,6 @@ Your goal is to craft an insightful, engaging response that seamlessly integrate
154
154
  usedTokens += await this._countMessageTokens(agentScratchpad);
155
155
  }
156
156
  }
157
- console.log(chatHistory.length);
158
157
  const formatResult = await this._formatWithMessagesPlaceholder(
159
158
  chatHistory,
160
159
  [longHistory, knowledge].concat(
@@ -236,10 +235,11 @@ Your goal is to craft an insightful, engaging response that seamlessly integrate
236
235
  usedToken += loreBookTokens;
237
236
  }
238
237
  for (const [position, array] of Object.entries(canUseLoreBooks)) {
239
- const message = this.variableService.formatMessages(
238
+ const message = await this.variableService.formatMessages(
240
239
  [await loreBooksPrompt.format({ input: array.join("\n") })],
241
240
  variables
242
- )[0];
241
+ ).then((value) => value[0]);
242
+ console.log(message);
243
243
  if (position === "default") {
244
244
  if (hasLongMemory) {
245
245
  const index = result.findIndex(
@@ -249,7 +249,7 @@ Your goal is to craft an insightful, engaging response that seamlessly integrate
249
249
  } else {
250
250
  result.push(message);
251
251
  }
252
- return;
252
+ continue;
253
253
  }
254
254
  const insertPosition = this._findIndex(
255
255
  result,
@@ -309,7 +309,7 @@ Your goal is to craft an insightful, engaging response that seamlessly integrate
309
309
  return chatHistory.length - 1;
310
310
  }
311
311
  const findIndexByType = /* @__PURE__ */ __name((type) => chatHistory.findIndex(
312
- (message) => message.additional_kwargs?.type === type
312
+ (message) => message?.additional_kwargs?.type === type
313
313
  ), "findIndexByType");
314
314
  const descriptionIndex = findIndexByType("description");
315
315
  const personalityIndex = findIndexByType("description");
@@ -141,7 +141,6 @@ Your goal is to craft an insightful, engaging response that seamlessly integrate
141
141
  usedTokens += await this._countMessageTokens(agentScratchpad);
142
142
  }
143
143
  }
144
- console.log(chatHistory.length);
145
144
  const formatResult = await this._formatWithMessagesPlaceholder(
146
145
  chatHistory,
147
146
  [longHistory, knowledge].concat(
@@ -223,10 +222,11 @@ Your goal is to craft an insightful, engaging response that seamlessly integrate
223
222
  usedToken += loreBookTokens;
224
223
  }
225
224
  for (const [position, array] of Object.entries(canUseLoreBooks)) {
226
- const message = this.variableService.formatMessages(
225
+ const message = await this.variableService.formatMessages(
227
226
  [await loreBooksPrompt.format({ input: array.join("\n") })],
228
227
  variables
229
- )[0];
228
+ ).then((value) => value[0]);
229
+ console.log(message);
230
230
  if (position === "default") {
231
231
  if (hasLongMemory) {
232
232
  const index = result.findIndex(
@@ -236,7 +236,7 @@ Your goal is to craft an insightful, engaging response that seamlessly integrate
236
236
  } else {
237
237
  result.push(message);
238
238
  }
239
- return;
239
+ continue;
240
240
  }
241
241
  const insertPosition = this._findIndex(
242
242
  result,
@@ -296,7 +296,7 @@ Your goal is to craft an insightful, engaging response that seamlessly integrate
296
296
  return chatHistory.length - 1;
297
297
  }
298
298
  const findIndexByType = /* @__PURE__ */ __name((type) => chatHistory.findIndex(
299
- (message) => message.additional_kwargs?.type === type
299
+ (message) => message?.additional_kwargs?.type === type
300
300
  ), "findIndexByType");
301
301
  const descriptionIndex = findIndexByType("description");
302
302
  const personalityIndex = findIndexByType("description");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chatluna",
3
3
  "description": "chatluna for koishi",
4
- "version": "1.2.0-alpha.8",
4
+ "version": "1.2.0",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",