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 +3 -2
- package/lib/type.d.ts +1 -0
- package/package.json +1 -1
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 <
|
|
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