koishi-plugin-chatluna-character 0.0.45 → 0.0.46
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 +2 -2
- package/lib/plugin.js +2 -1
- package/lib/plugins/chat.js +2 -1
- package/lib/plugins/commands.js +2 -1
- package/lib/plugins/config.js +2 -1
- package/lib/plugins/filter.js +2 -2
- package/lib/plugins/interception.js +2 -1
- package/lib/preset.js +2 -2
- package/lib/service/message.js +1 -1
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.name = exports.Config = exports.inject = void 0;
|
|
4
|
-
exports.apply = apply;
|
|
3
|
+
exports.name = exports.Config = exports.inject = exports.apply = void 0;
|
|
5
4
|
/* eslint-disable max-len */
|
|
6
5
|
const koishi_1 = require("koishi");
|
|
7
6
|
const plugin_1 = require("./plugin");
|
|
@@ -43,6 +42,7 @@ function apply(ctx, config) {
|
|
|
43
42
|
disposables.forEach((disposable) => disposable());
|
|
44
43
|
});
|
|
45
44
|
}
|
|
45
|
+
exports.apply = apply;
|
|
46
46
|
exports.inject = {
|
|
47
47
|
required: ['chatluna', 'cache'],
|
|
48
48
|
optional: ['chatluna_character', 'vits']
|
package/lib/plugin.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.plugins =
|
|
6
|
+
exports.plugins = void 0;
|
|
7
7
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
async function plugins(ctx, config) {
|
|
@@ -18,3 +18,4 @@ async function plugins(ctx, config) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
exports.plugins = plugins;
|
package/lib/plugins/chat.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.apply =
|
|
3
|
+
exports.apply = void 0;
|
|
4
4
|
const messages_1 = require("@langchain/core/messages");
|
|
5
5
|
const koishi_1 = require("koishi");
|
|
6
6
|
const count_tokens_1 = require("koishi-plugin-chatluna/lib/llm-core/utils/count_tokens");
|
|
@@ -141,6 +141,7 @@ async function apply(ctx, config) {
|
|
|
141
141
|
await service.broadcastOnBot(session, parsedResponse.elements.flat());
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
+
exports.apply = apply;
|
|
144
145
|
function isEmoticonStatement(text) {
|
|
145
146
|
const regex = /^[\p{P}\p{S}\p{Z}\p{M}\p{N}\p{L}\s]*\p{So}[\p{P}\p{S}\p{Z}\p{M}\p{N}\p{L}\s]*$/u;
|
|
146
147
|
return regex.test(text);
|
package/lib/plugins/commands.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.apply =
|
|
3
|
+
exports.apply = void 0;
|
|
4
4
|
const filter_1 = require("./filter");
|
|
5
5
|
function apply(ctx, config) {
|
|
6
6
|
ctx.command('chatluna.character', '角色扮演相关命令');
|
|
@@ -22,3 +22,4 @@ function apply(ctx, config) {
|
|
|
22
22
|
return `已清除群组 ${groupId} 的聊天记录`;
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
exports.apply = apply;
|
package/lib/plugins/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.apply =
|
|
3
|
+
exports.apply = void 0;
|
|
4
4
|
const koishi_1 = require("koishi");
|
|
5
5
|
const types_1 = require("koishi-plugin-chatluna/lib/llm-core/platform/types");
|
|
6
6
|
async function apply(ctx, config) {
|
|
@@ -12,6 +12,7 @@ async function apply(ctx, config) {
|
|
|
12
12
|
});
|
|
13
13
|
ctx.schema.set('model', koishi_1.Schema.union(await getModelNames(ctx.chatluna.platform)));
|
|
14
14
|
}
|
|
15
|
+
exports.apply = apply;
|
|
15
16
|
async function getModelNames(service) {
|
|
16
17
|
return service.getAllModels(types_1.ModelType.llm).map((m) => koishi_1.Schema.const(m));
|
|
17
18
|
}
|
package/lib/plugins/filter.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.groupInfos = void 0;
|
|
4
|
-
exports.apply = apply;
|
|
3
|
+
exports.apply = exports.groupInfos = void 0;
|
|
5
4
|
exports.groupInfos = {};
|
|
6
5
|
async function apply(ctx, config) {
|
|
7
6
|
const maxMessages = config.messageInterval;
|
|
@@ -91,3 +90,4 @@ async function apply(ctx, config) {
|
|
|
91
90
|
return false;
|
|
92
91
|
});
|
|
93
92
|
}
|
|
93
|
+
exports.apply = apply;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.apply =
|
|
3
|
+
exports.apply = void 0;
|
|
4
4
|
function apply(ctx, config) {
|
|
5
5
|
ctx.on('chatluna/before-check-sender', async (session) => {
|
|
6
6
|
const guildId = session.guildId;
|
|
@@ -33,3 +33,4 @@ function apply(ctx, config) {
|
|
|
33
33
|
return config.disableChatLuna;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
exports.apply = apply;
|
package/lib/preset.js
CHANGED
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Preset = void 0;
|
|
7
|
-
exports.loadPreset = loadPreset;
|
|
6
|
+
exports.loadPreset = exports.Preset = void 0;
|
|
8
7
|
const prompts_1 = require("@langchain/core/prompts");
|
|
9
8
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
10
9
|
const js_yaml_1 = require("js-yaml");
|
|
@@ -122,3 +121,4 @@ function loadPreset(text) {
|
|
|
122
121
|
mute_keyword: rawPreset.mute_keyword ?? []
|
|
123
122
|
};
|
|
124
123
|
}
|
|
124
|
+
exports.loadPreset = loadPreset;
|
package/lib/service/message.js
CHANGED
|
@@ -200,7 +200,7 @@ function mapElementToString(session, content, elements) {
|
|
|
200
200
|
for (const element of elements) {
|
|
201
201
|
if (element.type === 'text') {
|
|
202
202
|
const content = element.attrs.content;
|
|
203
|
-
if (content
|
|
203
|
+
if (content?.trimEnd()?.length > 0) {
|
|
204
204
|
filteredBuffer.push(content);
|
|
205
205
|
}
|
|
206
206
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-chatluna-character",
|
|
3
3
|
"description": "Let the large language model play a role, disguise as a group friend",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.46",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/ChatLunaLab/chatluna-character#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@langchain/core": "^0.1.
|
|
34
|
+
"@langchain/core": "^0.1.58",
|
|
35
35
|
"js-yaml": "^4.1.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"eslint-plugin-n": "^16.6.2",
|
|
49
49
|
"eslint-plugin-prettier": "^5.1.3",
|
|
50
50
|
"eslint-plugin-promise": "^6.1.1",
|
|
51
|
-
"koishi": "^4.17.
|
|
51
|
+
"koishi": "^4.17.4"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"koishi": "^4.17.
|
|
55
|
-
"koishi-plugin-chatluna": "^1.0.0-beta.
|
|
54
|
+
"koishi": "^4.17.4",
|
|
55
|
+
"koishi-plugin-chatluna": "^1.0.0-beta.44"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=18.0.0"
|