koishi-plugin-satori-ai 1.0.13 → 1.0.15

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.js CHANGED
@@ -95,6 +95,7 @@ var Sat = class extends import_koishi.Service {
95
95
  alias: import_koishi.Schema.array(String).default(["ai"]).description("触发命令;别名"),
96
96
  private: import_koishi.Schema.boolean().default(true).description("开启后私聊AI可触发对话, 不需要使用指令"),
97
97
  mention: import_koishi.Schema.boolean().default(true).description("开启后机器人被提及(at/引用)可触发对话"),
98
+ random_min_tokens: import_koishi.Schema.number().default(20).description("随机触发的最小长度"),
98
99
  randnum: import_koishi.Schema.number().role("slider").min(0).max(1).step(0.01).default(0).description("随机触发对话的概率,如需关闭可设置为 0"),
99
100
  sentences_divide: import_koishi.Schema.boolean().default(true).description("是否分句发送"),
100
101
  time_interval: import_koishi.Schema.number().default(1e3).description("每句话的时间间隔"),
@@ -374,9 +375,9 @@ var SAt = class extends Sat {
374
375
  ${this.pluginConfig.prompt_4}
375
376
  `;
376
377
  }
377
- this.personality["人格"][0].content += `发言者的名字: ${session.username},发言者的id:${session.userId}`;
378
378
  logger.info(`名字: ${session.username}, 关系: ${level}`);
379
379
  }
380
+ this.personality["人格"][0].content += `发言者的名字: ${session.username},发言者的id:${session.userId}`;
380
381
  sortedMatches = searchKeywordsInFile(commonSenseFilePath, USERID);
381
382
  if (sortedMatches.length > 0)
382
383
  this.personality["人格"][0].content += appendTopMatches(commonSenseContent, sortedMatches, 1, "这是发言者的真实身份:");
@@ -409,7 +410,7 @@ var SAt = class extends Sat {
409
410
  }
410
411
  if (session.event.message.elements[0].type == "img" || session.event.message.elements[0].type == "at")
411
412
  return next();
412
- if (session.content.length < 20 || session.content.length >= this.pluginConfig.max_tokens)
413
+ if (session.content.length < this.pluginConfig.random_min_tokens || session.content.length >= this.pluginConfig.max_tokens)
413
414
  return next();
414
415
  const randnum = Math.random();
415
416
  if (randnum < this.pluginConfig.randnum)
package/lib/type.d.ts CHANGED
@@ -50,6 +50,7 @@ export declare namespace Sat {
50
50
  alias: string[];
51
51
  private: boolean;
52
52
  mention: boolean;
53
+ random_min_tokens: number;
53
54
  randnum: number;
54
55
  sentences_divide: boolean;
55
56
  time_interval: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-satori-ai",
3
3
  "description": "适用于satori适配器的ai对话,具有长期记忆、常识写入和好感度功能",
4
- "version": "1.0.13",
4
+ "version": "1.0.15",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "types": "lib/index.d.ts",