koishi-plugin-satori-ai 1.0.2 → 1.0.3
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.d.ts +0 -1
- package/lib/index.js +4 -10
- package/lib/type.d.ts +1 -0
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Context, segment, Element, Session, Next, Fragment } from 'koishi';
|
|
2
2
|
import { Sat } from './type';
|
|
3
|
-
export declare const usage = "\u4F7F\u7528\u8BF4\u660E\u89C1\u63D2\u4EF6\u4E3B\u9875";
|
|
4
3
|
type ChatCallback = (session: Session, session_of_id: Sat.Msg[]) => Promise<string>;
|
|
5
4
|
declare module 'koishi' {
|
|
6
5
|
interface Context {
|
package/lib/index.js
CHANGED
|
@@ -40,8 +40,7 @@ var require_zh = __commonJS({
|
|
|
40
40
|
// src/index.tsx
|
|
41
41
|
var src_exports = {};
|
|
42
42
|
__export(src_exports, {
|
|
43
|
-
default: () => src_default
|
|
44
|
-
usage: () => usage
|
|
43
|
+
default: () => src_default
|
|
45
44
|
});
|
|
46
45
|
module.exports = __toCommonJS(src_exports);
|
|
47
46
|
var import_koishi2 = require("koishi");
|
|
@@ -121,7 +120,6 @@ var Sat = class extends import_koishi.Service {
|
|
|
121
120
|
// src/index.tsx
|
|
122
121
|
var fs = __toESM(require("fs"));
|
|
123
122
|
var path = __toESM(require("path"));
|
|
124
|
-
var usage = `使用说明见插件主页`;
|
|
125
123
|
var name = "satori-ai";
|
|
126
124
|
var logger = new import_koishi2.Logger(name);
|
|
127
125
|
var debug = 0;
|
|
@@ -266,7 +264,7 @@ var SAt = class extends Sat {
|
|
|
266
264
|
const matchContent = commonSenseContent[sortedMatches[i].index].content.split("").filter((word) => !charactersToRemove.includes(word));
|
|
267
265
|
const reSortedMatches = searchKeywordsInFile(commonSenseFilePath, matchContent);
|
|
268
266
|
if (reSortedMatches.length > 0) {
|
|
269
|
-
this.personality["人格"][0].content += appendTopMatches(commonSenseContent, reSortedMatches, 3, `这是第${i + 1}
|
|
267
|
+
this.personality["人格"][0].content += appendTopMatches(commonSenseContent, reSortedMatches, 3, `这是第${i + 1}条信息的补充信息:`, 1);
|
|
270
268
|
}
|
|
271
269
|
}
|
|
272
270
|
}
|
|
@@ -537,8 +535,8 @@ function searchKeywordsInFile(filePath, keywords) {
|
|
|
537
535
|
return sortedMatches;
|
|
538
536
|
}
|
|
539
537
|
__name(searchKeywordsInFile, "searchKeywordsInFile");
|
|
540
|
-
function appendTopMatches(dialogues, sortedMatches, topN, prefix) {
|
|
541
|
-
const topMatches = sortedMatches.slice(
|
|
538
|
+
function appendTopMatches(dialogues, sortedMatches, topN, prefix, begin = 0) {
|
|
539
|
+
const topMatches = sortedMatches.slice(begin, topN);
|
|
542
540
|
const personalityContent = `
|
|
543
541
|
${prefix}{
|
|
544
542
|
` + topMatches.map((item) => dialogues[item.index].content).join("\n") + "\n}";
|
|
@@ -567,7 +565,3 @@ async function getTimeOfDay() {
|
|
|
567
565
|
}
|
|
568
566
|
__name(getTimeOfDay, "getTimeOfDay");
|
|
569
567
|
var src_default = SAt;
|
|
570
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
571
|
-
0 && (module.exports = {
|
|
572
|
-
usage
|
|
573
|
-
});
|
package/lib/type.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-satori-ai",
|
|
3
|
-
"description": "适用于satori的ai
|
|
4
|
-
"version": "1.0.
|
|
3
|
+
"description": "适用于satori的ai对话,请务必使用最新版本",
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"koishi": "^4.17.10"
|
|
33
33
|
},
|
|
34
34
|
"koishi": {
|
|
35
|
-
"description": "
|
|
35
|
+
"description": "适用于satori的ai对话",
|
|
36
36
|
"browser": true
|
|
37
37
|
}
|
|
38
38
|
}
|