koishi-plugin-chatluna 1.4.3 → 1.4.4
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.cjs +172 -200
- package/lib/index.mjs +29 -60
- package/lib/llm-core/agent/sub-agent/tool.d.ts +8 -8
- package/lib/migration/validators.d.ts +1 -1
- package/lib/services/chat.cjs +33 -75
- package/lib/services/chat.mjs +33 -75
- package/lib/services/message_transform.d.ts +0 -1
- package/lib/utils/koishi.cjs +0 -33
- package/lib/utils/koishi.d.ts +0 -3
- package/lib/utils/koishi.mjs +0 -30
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -78,9 +78,9 @@ __export(index_exports, {
|
|
|
78
78
|
usage: () => usage
|
|
79
79
|
});
|
|
80
80
|
module.exports = __toCommonJS(index_exports);
|
|
81
|
-
var
|
|
81
|
+
var import_koishi26 = require("koishi");
|
|
82
82
|
var import_chat2 = require("koishi-plugin-chatluna/services/chat");
|
|
83
|
-
var
|
|
83
|
+
var import_koishi27 = require("koishi-plugin-chatluna/utils/koishi");
|
|
84
84
|
var import_logger7 = require("koishi-plugin-chatluna/utils/logger");
|
|
85
85
|
var request = __toESM(require("koishi-plugin-chatluna/utils/request"), 1);
|
|
86
86
|
|
|
@@ -3549,7 +3549,6 @@ __name(createPendingMessage, "createPendingMessage");
|
|
|
3549
3549
|
var import_koishi8 = require("koishi");
|
|
3550
3550
|
var import_string6 = require("koishi-plugin-chatluna/utils/string");
|
|
3551
3551
|
var import_types5 = require("koishi-plugin-chatluna/llm-core/platform/types");
|
|
3552
|
-
var import_koishi9 = require("koishi-plugin-chatluna/utils/koishi");
|
|
3553
3552
|
var import_count_tokens3 = require("koishi-plugin-chatluna/llm-core/utils/count_tokens");
|
|
3554
3553
|
var import_base64 = require("koishi-plugin-chatluna/utils/base64");
|
|
3555
3554
|
|
|
@@ -3590,7 +3589,6 @@ var SUPPORTED_AUDIO_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
|
3590
3589
|
"audio/aiff"
|
|
3591
3590
|
]);
|
|
3592
3591
|
function apply18(ctx, config, chain) {
|
|
3593
|
-
const forwardHistory = /* @__PURE__ */ new WeakMap();
|
|
3594
3592
|
const fileSizes = /* @__PURE__ */ new WeakMap();
|
|
3595
3593
|
const handledAudio = /* @__PURE__ */ new WeakSet();
|
|
3596
3594
|
chain.middleware("read_chat_message", async (session, context) => {
|
|
@@ -3655,7 +3653,7 @@ function apply18(ctx, config, chain) {
|
|
|
3655
3653
|
if (message == null || resolved == null) {
|
|
3656
3654
|
return 2 /* CONTINUE */;
|
|
3657
3655
|
}
|
|
3658
|
-
const
|
|
3656
|
+
const msg = await ctx.chatluna.messageTransformer.transform(
|
|
3659
3657
|
session,
|
|
3660
3658
|
message,
|
|
3661
3659
|
ctx.chatluna.conversation.pickModel(
|
|
@@ -3673,23 +3671,10 @@ function apply18(ctx, config, chain) {
|
|
|
3673
3671
|
includeQuoteReply: config.includeQuoteReply
|
|
3674
3672
|
}
|
|
3675
3673
|
);
|
|
3676
|
-
if (
|
|
3677
|
-
const state = forwardHistory.get(transformedMessage);
|
|
3678
|
-
if (state?.hasForwardHistory) {
|
|
3679
|
-
if (state.ids.length > 0) {
|
|
3680
|
-
transformedMessage.additional_kwargs ??= {};
|
|
3681
|
-
transformedMessage.additional_kwargs.forwardMessageIds = state.ids;
|
|
3682
|
-
}
|
|
3683
|
-
addMessageContent(
|
|
3684
|
-
transformedMessage,
|
|
3685
|
-
state.ids.length > 0 ? state.ids.map((id) => `<forward id="${id}"/>`).join("") : "<forward/>"
|
|
3686
|
-
);
|
|
3687
|
-
}
|
|
3688
|
-
}
|
|
3689
|
-
if (transformedMessage.content.length < 1 && (0, import_string6.getMessageContent)(transformedMessage.content).trim().length < 1) {
|
|
3674
|
+
if (msg.content.length < 1 && (0, import_string6.getMessageContent)(msg.content).trim().length < 1) {
|
|
3690
3675
|
return 1 /* STOP */;
|
|
3691
3676
|
}
|
|
3692
|
-
context.options.inputMessage =
|
|
3677
|
+
context.options.inputMessage = msg;
|
|
3693
3678
|
return 2 /* CONTINUE */;
|
|
3694
3679
|
}).after("resolve_conversation").before("message_delay");
|
|
3695
3680
|
ctx.chatluna.messageTransformer.before(async (session, elements) => {
|
|
@@ -3716,17 +3701,17 @@ function apply18(ctx, config, chain) {
|
|
|
3716
3701
|
);
|
|
3717
3702
|
ctx.chatluna.messageTransformer.intercept(
|
|
3718
3703
|
"forward",
|
|
3719
|
-
async (session,
|
|
3720
|
-
if (
|
|
3721
|
-
trackForwardId(forwardHistory, element, message);
|
|
3704
|
+
async (session, el, msg) => {
|
|
3705
|
+
if (config.attachForwardMsgIdToContext) addForward(msg, el);
|
|
3722
3706
|
}
|
|
3723
3707
|
);
|
|
3724
3708
|
ctx.chatluna.messageTransformer.intercept(
|
|
3725
3709
|
"message",
|
|
3726
|
-
async (session,
|
|
3727
|
-
if (
|
|
3728
|
-
|
|
3729
|
-
|
|
3710
|
+
async (session, el, msg) => {
|
|
3711
|
+
if (config.attachForwardMsgIdToContext && ["true", "1"].includes(String(el.attrs.forward))) {
|
|
3712
|
+
addForward(msg, el);
|
|
3713
|
+
}
|
|
3714
|
+
return false;
|
|
3730
3715
|
}
|
|
3731
3716
|
);
|
|
3732
3717
|
ctx.chatluna.messageTransformer.intercept(
|
|
@@ -4120,25 +4105,25 @@ function modelSupportsElement(ctx, model, type) {
|
|
|
4120
4105
|
);
|
|
4121
4106
|
}
|
|
4122
4107
|
__name(modelSupportsElement, "modelSupportsElement");
|
|
4108
|
+
function addForward(message, element) {
|
|
4109
|
+
const id = element.attrs.id?.toString();
|
|
4110
|
+
if (!id) {
|
|
4111
|
+
addMessageContent(message, "<forward/>");
|
|
4112
|
+
return;
|
|
4113
|
+
}
|
|
4114
|
+
message.additional_kwargs ??= {};
|
|
4115
|
+
const ids = message.additional_kwargs.forwardMessageIds ??= [];
|
|
4116
|
+
if (ids.includes(id)) return;
|
|
4117
|
+
ids.push(id);
|
|
4118
|
+
addMessageContent(message, (0, import_koishi8.h)("forward", { id }).toString());
|
|
4119
|
+
}
|
|
4120
|
+
__name(addForward, "addForward");
|
|
4123
4121
|
function setElementUrl(element, url) {
|
|
4124
4122
|
element.attrs["imageUrl"] = url;
|
|
4125
4123
|
element.attrs["src"] = url;
|
|
4126
4124
|
element.attrs["url"] = url;
|
|
4127
4125
|
}
|
|
4128
4126
|
__name(setElementUrl, "setElementUrl");
|
|
4129
|
-
function trackForwardId(history, element, message) {
|
|
4130
|
-
const state = history.get(message) ?? {
|
|
4131
|
-
ids: [],
|
|
4132
|
-
hasForwardHistory: false
|
|
4133
|
-
};
|
|
4134
|
-
history.set(message, state);
|
|
4135
|
-
state.hasForwardHistory = true;
|
|
4136
|
-
const id = (0, import_koishi9.pickForwardMessageId)(element);
|
|
4137
|
-
if (id && !state.ids.includes(id)) {
|
|
4138
|
-
state.ids.push(id);
|
|
4139
|
-
}
|
|
4140
|
-
}
|
|
4141
|
-
__name(trackForwardId, "trackForwardId");
|
|
4142
4127
|
function appendQQAttachments(session, elements) {
|
|
4143
4128
|
if (session.platform !== "qq") {
|
|
4144
4129
|
return;
|
|
@@ -4223,7 +4208,7 @@ __name(renderMessage, "renderMessage");
|
|
|
4223
4208
|
|
|
4224
4209
|
// src/middlewares/chat/rollback_chat.ts
|
|
4225
4210
|
var import_string7 = require("koishi-plugin-chatluna/utils/string");
|
|
4226
|
-
var
|
|
4211
|
+
var import_koishi9 = require("koishi-plugin-chatluna/utils/koishi");
|
|
4227
4212
|
var MAX_ROLLBACK_HOPS = 1e3;
|
|
4228
4213
|
function apply20(ctx, config, chain) {
|
|
4229
4214
|
chain.middleware("rollback_chat", async (session, context) => {
|
|
@@ -4295,7 +4280,7 @@ async function rollbackConversation(ctx, config, session, context, conversation,
|
|
|
4295
4280
|
msg: session.text(".conversation_not_exist")
|
|
4296
4281
|
};
|
|
4297
4282
|
}
|
|
4298
|
-
if (resolved.constraint.manageMode === "admin" && !await (0,
|
|
4283
|
+
if (resolved.constraint.manageMode === "admin" && !await (0, import_koishi9.checkAdmin)(session)) {
|
|
4299
4284
|
return {
|
|
4300
4285
|
status: 1 /* STOP */,
|
|
4301
4286
|
msg: session.text(".conversation_not_exist")
|
|
@@ -4361,7 +4346,7 @@ async function rollbackConversation(ctx, config, session, context, conversation,
|
|
|
4361
4346
|
const humanContent = await decodeMessageContent(humanMessage);
|
|
4362
4347
|
inputMessage = await ctx.chatluna.messageTransformer.transform(
|
|
4363
4348
|
session,
|
|
4364
|
-
(0,
|
|
4349
|
+
(0, import_koishi9.transformMessageContentToElements)(humanContent),
|
|
4365
4350
|
ctx.chatluna.conversation.pickModel(resolved.constraint, current) ?? current.model,
|
|
4366
4351
|
{
|
|
4367
4352
|
content: "",
|
|
@@ -4393,7 +4378,7 @@ async function rollbackConversation(ctx, config, session, context, conversation,
|
|
|
4393
4378
|
__name(rollbackConversation, "rollbackConversation");
|
|
4394
4379
|
|
|
4395
4380
|
// src/middlewares/chat/stop_chat.ts
|
|
4396
|
-
var
|
|
4381
|
+
var import_koishi10 = require("koishi-plugin-chatluna/utils/koishi");
|
|
4397
4382
|
function apply21(ctx, config, chain) {
|
|
4398
4383
|
chain.middleware("stop_chat", async (session, context) => {
|
|
4399
4384
|
const { command: command2 } = context;
|
|
@@ -4415,7 +4400,7 @@ function apply21(ctx, config, chain) {
|
|
|
4415
4400
|
context.message = session.text(".no_active_chat");
|
|
4416
4401
|
return 1 /* STOP */;
|
|
4417
4402
|
}
|
|
4418
|
-
if (resolved.constraint.manageMode === "admin" && !await (0,
|
|
4403
|
+
if (resolved.constraint.manageMode === "admin" && !await (0, import_koishi10.checkAdmin)(session)) {
|
|
4419
4404
|
context.message = session.text(".stop_failed");
|
|
4420
4405
|
return 1 /* STOP */;
|
|
4421
4406
|
}
|
|
@@ -5595,10 +5580,10 @@ function apply39(ctx, config, chain) {
|
|
|
5595
5580
|
__name(apply39, "apply");
|
|
5596
5581
|
|
|
5597
5582
|
// src/middlewares/system/conversation_manage.ts
|
|
5598
|
-
var
|
|
5583
|
+
var import_koishi11 = require("koishi");
|
|
5599
5584
|
var import_error8 = require("koishi-plugin-chatluna/utils/error");
|
|
5600
5585
|
var import_pagination7 = require("koishi-plugin-chatluna/utils/pagination");
|
|
5601
|
-
var
|
|
5586
|
+
var import_koishi12 = require("koishi-plugin-chatluna/utils/koishi");
|
|
5602
5587
|
var import_promises6 = __toESM(require("fs/promises"), 1);
|
|
5603
5588
|
function apply40(ctx, config, chain) {
|
|
5604
5589
|
function middleware2(name2, fn) {
|
|
@@ -5621,7 +5606,7 @@ function apply40(ctx, config, chain) {
|
|
|
5621
5606
|
);
|
|
5622
5607
|
return 1 /* STOP */;
|
|
5623
5608
|
}
|
|
5624
|
-
if (resolved.constraint.manageMode === "admin" && resolved.constraint.routeMode !== "personal" && !await (0,
|
|
5609
|
+
if (resolved.constraint.manageMode === "admin" && resolved.constraint.routeMode !== "personal" && !await (0, import_koishi12.checkAdmin)(session)) {
|
|
5625
5610
|
context.message = session.text(
|
|
5626
5611
|
"chatluna.conversation.messages.admin_required",
|
|
5627
5612
|
[import_error8.ChatLunaErrorCode.CONVERSATION_ADMIN_REQUIRED]
|
|
@@ -5964,7 +5949,7 @@ function apply40(ctx, config, chain) {
|
|
|
5964
5949
|
try {
|
|
5965
5950
|
const buffer = await import_promises6.default.readFile(result.path);
|
|
5966
5951
|
await session.send(
|
|
5967
|
-
|
|
5952
|
+
import_koishi11.h.file(buffer, "application/markdown", {
|
|
5968
5953
|
title: result.conversation.title + ".md"
|
|
5969
5954
|
})
|
|
5970
5955
|
);
|
|
@@ -6726,106 +6711,106 @@ async function unbindConversation(ctx, conversationId) {
|
|
|
6726
6711
|
__name(unbindConversation, "unbindConversation");
|
|
6727
6712
|
|
|
6728
6713
|
// src/config.ts
|
|
6729
|
-
var
|
|
6730
|
-
var Config2 =
|
|
6731
|
-
|
|
6732
|
-
botNames:
|
|
6733
|
-
isNickname:
|
|
6734
|
-
isNickNameWithContent:
|
|
6714
|
+
var import_koishi13 = require("koishi");
|
|
6715
|
+
var Config2 = import_koishi13.Schema.intersect([
|
|
6716
|
+
import_koishi13.Schema.object({
|
|
6717
|
+
botNames: import_koishi13.Schema.array(import_koishi13.Schema.string()).default(["香草"]),
|
|
6718
|
+
isNickname: import_koishi13.Schema.boolean().default(true),
|
|
6719
|
+
isNickNameWithContent: import_koishi13.Schema.boolean().default(false)
|
|
6735
6720
|
}),
|
|
6736
|
-
|
|
6737
|
-
allowPrivate:
|
|
6738
|
-
allowAtReply:
|
|
6739
|
-
allowQuoteReply:
|
|
6740
|
-
privateChatWithoutCommand:
|
|
6741
|
-
includeQuoteReply:
|
|
6742
|
-
randomReplyFrequency:
|
|
6743
|
-
attachForwardMsgIdToContext:
|
|
6744
|
-
autoUpdateConversationModel:
|
|
6721
|
+
import_koishi13.Schema.object({
|
|
6722
|
+
allowPrivate: import_koishi13.Schema.boolean().default(true),
|
|
6723
|
+
allowAtReply: import_koishi13.Schema.boolean().default(true),
|
|
6724
|
+
allowQuoteReply: import_koishi13.Schema.boolean().default(false),
|
|
6725
|
+
privateChatWithoutCommand: import_koishi13.Schema.boolean().default(true),
|
|
6726
|
+
includeQuoteReply: import_koishi13.Schema.boolean().default(true),
|
|
6727
|
+
randomReplyFrequency: import_koishi13.Schema.percent().min(0).max(1).step(0.01).default(0).computed(),
|
|
6728
|
+
attachForwardMsgIdToContext: import_koishi13.Schema.boolean().default(false),
|
|
6729
|
+
autoUpdateConversationModel: import_koishi13.Schema.boolean().default(false)
|
|
6745
6730
|
}),
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
isForwardMsg:
|
|
6731
|
+
import_koishi13.Schema.intersect([
|
|
6732
|
+
import_koishi13.Schema.object({
|
|
6733
|
+
isForwardMsg: import_koishi13.Schema.boolean().default(false)
|
|
6749
6734
|
}),
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
isForwardMsg:
|
|
6753
|
-
forwardMsgMinLength:
|
|
6735
|
+
import_koishi13.Schema.union([
|
|
6736
|
+
import_koishi13.Schema.object({
|
|
6737
|
+
isForwardMsg: import_koishi13.Schema.const(true).required(),
|
|
6738
|
+
forwardMsgMinLength: import_koishi13.Schema.number().min(0).max(400).step(1).default(0)
|
|
6754
6739
|
}),
|
|
6755
|
-
|
|
6740
|
+
import_koishi13.Schema.object({})
|
|
6756
6741
|
])
|
|
6757
6742
|
]),
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
isReplyWithAt:
|
|
6743
|
+
import_koishi13.Schema.intersect([
|
|
6744
|
+
import_koishi13.Schema.object({
|
|
6745
|
+
isReplyWithAt: import_koishi13.Schema.boolean().default(false)
|
|
6761
6746
|
}),
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
isReplyWithAt:
|
|
6765
|
-
replyQuoteThreshold:
|
|
6747
|
+
import_koishi13.Schema.union([
|
|
6748
|
+
import_koishi13.Schema.object({
|
|
6749
|
+
isReplyWithAt: import_koishi13.Schema.const(true).required(),
|
|
6750
|
+
replyQuoteThreshold: import_koishi13.Schema.number().min(0).max(600).step(1).default(0)
|
|
6766
6751
|
}),
|
|
6767
|
-
|
|
6752
|
+
import_koishi13.Schema.object({})
|
|
6768
6753
|
])
|
|
6769
6754
|
]),
|
|
6770
|
-
|
|
6771
|
-
sendThinkingMessage:
|
|
6772
|
-
sendThinkingMessageTimeout:
|
|
6773
|
-
msgCooldown:
|
|
6774
|
-
messageQueue:
|
|
6775
|
-
messageQueueDelay:
|
|
6776
|
-
agentTaskAutoWakeup:
|
|
6777
|
-
showThoughtMessage:
|
|
6755
|
+
import_koishi13.Schema.object({
|
|
6756
|
+
sendThinkingMessage: import_koishi13.Schema.boolean().default(true),
|
|
6757
|
+
sendThinkingMessageTimeout: import_koishi13.Schema.number().default(15e3),
|
|
6758
|
+
msgCooldown: import_koishi13.Schema.number().min(0).max(3600).step(1).default(0),
|
|
6759
|
+
messageQueue: import_koishi13.Schema.boolean().default(true),
|
|
6760
|
+
messageQueueDelay: import_koishi13.Schema.number().min(0).max(60 * 30).default(0),
|
|
6761
|
+
agentTaskAutoWakeup: import_koishi13.Schema.boolean().default(true),
|
|
6762
|
+
showThoughtMessage: import_koishi13.Schema.boolean().default(false)
|
|
6778
6763
|
}),
|
|
6779
|
-
|
|
6780
|
-
outputMode:
|
|
6781
|
-
splitMessage:
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6764
|
+
import_koishi13.Schema.object({
|
|
6765
|
+
outputMode: import_koishi13.Schema.dynamic("output-mode").default("text"),
|
|
6766
|
+
splitMessage: import_koishi13.Schema.union([
|
|
6767
|
+
import_koishi13.Schema.const("none"),
|
|
6768
|
+
import_koishi13.Schema.const("punctuation"),
|
|
6769
|
+
import_koishi13.Schema.const("paragraph")
|
|
6785
6770
|
]).default("none"),
|
|
6786
|
-
censor:
|
|
6787
|
-
rawOnCensor:
|
|
6788
|
-
streamResponse:
|
|
6771
|
+
censor: import_koishi13.Schema.boolean().default(false),
|
|
6772
|
+
rawOnCensor: import_koishi13.Schema.boolean().default(false),
|
|
6773
|
+
streamResponse: import_koishi13.Schema.boolean().default(false)
|
|
6789
6774
|
}),
|
|
6790
|
-
|
|
6791
|
-
blackList:
|
|
6775
|
+
import_koishi13.Schema.object({
|
|
6776
|
+
blackList: import_koishi13.Schema.number().min(0).max(1).step(1).default(0).computed().default(0)
|
|
6792
6777
|
}),
|
|
6793
|
-
|
|
6794
|
-
infiniteContext:
|
|
6795
|
-
infiniteContextThreshold:
|
|
6796
|
-
autoArchive:
|
|
6797
|
-
autoArchiveTimeout:
|
|
6798
|
-
autoPurgeArchive:
|
|
6799
|
-
autoPurgeArchiveTimeout:
|
|
6778
|
+
import_koishi13.Schema.object({
|
|
6779
|
+
infiniteContext: import_koishi13.Schema.boolean().default(true),
|
|
6780
|
+
infiniteContextThreshold: import_koishi13.Schema.percent().min(0.5).max(0.95).step(0.01).default(0.85),
|
|
6781
|
+
autoArchive: import_koishi13.Schema.boolean().default(false),
|
|
6782
|
+
autoArchiveTimeout: import_koishi13.Schema.number().default(import_koishi13.Time.day * 10 / import_koishi13.Time.second).min(import_koishi13.Time.hour / import_koishi13.Time.second),
|
|
6783
|
+
autoPurgeArchive: import_koishi13.Schema.boolean().default(false),
|
|
6784
|
+
autoPurgeArchiveTimeout: import_koishi13.Schema.number().default(import_koishi13.Time.day * 30 / import_koishi13.Time.second).min(import_koishi13.Time.hour / import_koishi13.Time.second)
|
|
6800
6785
|
}),
|
|
6801
|
-
|
|
6802
|
-
defaultEmbeddings:
|
|
6803
|
-
defaultVectorStore:
|
|
6786
|
+
import_koishi13.Schema.object({
|
|
6787
|
+
defaultEmbeddings: import_koishi13.Schema.dynamic("embeddings").default("无"),
|
|
6788
|
+
defaultVectorStore: import_koishi13.Schema.dynamic("vector-store").default("无")
|
|
6804
6789
|
}),
|
|
6805
|
-
|
|
6806
|
-
defaultGroupRouteMode:
|
|
6807
|
-
|
|
6808
|
-
|
|
6790
|
+
import_koishi13.Schema.object({
|
|
6791
|
+
defaultGroupRouteMode: import_koishi13.Schema.union([
|
|
6792
|
+
import_koishi13.Schema.const("shared"),
|
|
6793
|
+
import_koishi13.Schema.const("personal")
|
|
6809
6794
|
]).default("shared"),
|
|
6810
|
-
defaultChatMode:
|
|
6811
|
-
defaultModel:
|
|
6812
|
-
defaultPreset:
|
|
6813
|
-
enablePresetKeywordTrigger:
|
|
6795
|
+
defaultChatMode: import_koishi13.Schema.dynamic("chat-mode").default("plugin"),
|
|
6796
|
+
defaultModel: import_koishi13.Schema.dynamic("model").default("无"),
|
|
6797
|
+
defaultPreset: import_koishi13.Schema.dynamic("preset").default("sydney"),
|
|
6798
|
+
enablePresetKeywordTrigger: import_koishi13.Schema.boolean().default(true)
|
|
6814
6799
|
}),
|
|
6815
|
-
|
|
6816
|
-
voiceSpeakId:
|
|
6817
|
-
isLog:
|
|
6800
|
+
import_koishi13.Schema.object({
|
|
6801
|
+
voiceSpeakId: import_koishi13.Schema.number().default(0),
|
|
6802
|
+
isLog: import_koishi13.Schema.boolean().default(false)
|
|
6818
6803
|
}),
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
isProxy:
|
|
6804
|
+
import_koishi13.Schema.intersect([
|
|
6805
|
+
import_koishi13.Schema.object({
|
|
6806
|
+
isProxy: import_koishi13.Schema.boolean().default(false)
|
|
6822
6807
|
}),
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
isProxy:
|
|
6826
|
-
proxyAddress:
|
|
6808
|
+
import_koishi13.Schema.union([
|
|
6809
|
+
import_koishi13.Schema.object({
|
|
6810
|
+
isProxy: import_koishi13.Schema.const(true).required(),
|
|
6811
|
+
proxyAddress: import_koishi13.Schema.string().default("http://127.0.0.1:7897")
|
|
6827
6812
|
}),
|
|
6828
|
-
|
|
6813
|
+
import_koishi13.Schema.object({})
|
|
6829
6814
|
])
|
|
6830
6815
|
])
|
|
6831
6816
|
]).i18n({
|
|
@@ -6834,23 +6819,23 @@ var Config2 = import_koishi14.Schema.intersect([
|
|
|
6834
6819
|
});
|
|
6835
6820
|
|
|
6836
6821
|
// src/render/index.ts
|
|
6837
|
-
var
|
|
6822
|
+
var import_koishi25 = require("koishi");
|
|
6838
6823
|
var import_error9 = require("koishi-plugin-chatluna/utils/error");
|
|
6839
6824
|
|
|
6840
6825
|
// src/render/koishi-element.ts
|
|
6841
|
-
var
|
|
6826
|
+
var import_koishi17 = require("koishi");
|
|
6842
6827
|
var import_koishi_plugin_chatluna9 = require("koishi-plugin-chatluna");
|
|
6843
6828
|
var import_string11 = require("koishi-plugin-chatluna/utils/string");
|
|
6844
|
-
var
|
|
6829
|
+
var import_koishi18 = require("koishi-plugin-chatluna/utils/koishi");
|
|
6845
6830
|
|
|
6846
6831
|
// src/render/base.ts
|
|
6847
|
-
var
|
|
6832
|
+
var import_koishi16 = require("koishi");
|
|
6848
6833
|
var import_string10 = require("koishi-plugin-chatluna/utils/string");
|
|
6849
6834
|
|
|
6850
6835
|
// src/render/split.ts
|
|
6851
|
-
var
|
|
6836
|
+
var import_koishi14 = require("koishi");
|
|
6852
6837
|
var import_string9 = require("koishi-plugin-chatluna/utils/string");
|
|
6853
|
-
var
|
|
6838
|
+
var import_koishi15 = require("koishi-plugin-chatluna/utils/koishi");
|
|
6854
6839
|
|
|
6855
6840
|
// src/render/sentence.ts
|
|
6856
6841
|
var import_grapheme = require("unicode-segmenter/grapheme");
|
|
@@ -7130,16 +7115,16 @@ var MessageElementSplitter = class {
|
|
|
7130
7115
|
writeText(text) {
|
|
7131
7116
|
if (!text) return [];
|
|
7132
7117
|
this.buf += text;
|
|
7133
|
-
const result = (0,
|
|
7118
|
+
const result = (0, import_koishi15.parseElements)(this.buf, true);
|
|
7134
7119
|
this.buf = result.rest;
|
|
7135
7120
|
return result.elements;
|
|
7136
7121
|
}
|
|
7137
7122
|
flush() {
|
|
7138
7123
|
if (!this.buf.trim()) return [];
|
|
7139
7124
|
try {
|
|
7140
|
-
return (0,
|
|
7125
|
+
return (0, import_koishi15.parseElements)(this.buf);
|
|
7141
7126
|
} catch {
|
|
7142
|
-
return [
|
|
7127
|
+
return [import_koishi14.h.text(this.buf)];
|
|
7143
7128
|
} finally {
|
|
7144
7129
|
this.buf = "";
|
|
7145
7130
|
}
|
|
@@ -7234,7 +7219,7 @@ var BufferedRenderStreamSession = class {
|
|
|
7234
7219
|
const elements = await this.renderText(part);
|
|
7235
7220
|
result.push(
|
|
7236
7221
|
...this.options.split && this.options.split !== "none" ? elements.map(
|
|
7237
|
-
(el) => el.type === "message" ? el : (0,
|
|
7222
|
+
(el) => el.type === "message" ? el : (0, import_koishi16.h)("message", el)
|
|
7238
7223
|
) : elements
|
|
7239
7224
|
);
|
|
7240
7225
|
}
|
|
@@ -7252,7 +7237,7 @@ var KoishiElementRenderer = class extends Renderer {
|
|
|
7252
7237
|
transformed = transformAndEscape(transformed);
|
|
7253
7238
|
if (options.split && options.split !== "none") {
|
|
7254
7239
|
transformed = transformed.map(
|
|
7255
|
-
(element) => element.type === "message" ? element : (0,
|
|
7240
|
+
(element) => element.type === "message" ? element : (0, import_koishi17.h)("message", element)
|
|
7256
7241
|
);
|
|
7257
7242
|
}
|
|
7258
7243
|
return {
|
|
@@ -7269,7 +7254,7 @@ var KoishiElementRenderer = class extends Renderer {
|
|
|
7269
7254
|
createStreamSession(options, plan) {
|
|
7270
7255
|
return new KoishiElementStreamSession(options, plan);
|
|
7271
7256
|
}
|
|
7272
|
-
schema =
|
|
7257
|
+
schema = import_koishi17.Schema.const("koishi-element").i18n({
|
|
7273
7258
|
"zh-CN": "将回复作为 koishi 消息元素进行渲染",
|
|
7274
7259
|
"en-US": "Render as koishi message element template"
|
|
7275
7260
|
});
|
|
@@ -7293,12 +7278,12 @@ var KoishiElementStreamSession = class {
|
|
|
7293
7278
|
if (!text) return null;
|
|
7294
7279
|
if (this.plan.mode === "edit") {
|
|
7295
7280
|
this.text += text;
|
|
7296
|
-
return transformAndEscape([
|
|
7281
|
+
return transformAndEscape([import_koishi17.h.text(this.text + "●")]);
|
|
7297
7282
|
}
|
|
7298
7283
|
let elements = this.splitter.writeText(text);
|
|
7299
7284
|
if (this.options.split && this.options.split !== "none") {
|
|
7300
7285
|
elements = elements.map(
|
|
7301
|
-
(el) => el.type === "message" ? el : (0,
|
|
7286
|
+
(el) => el.type === "message" ? el : (0, import_koishi17.h)("message", el)
|
|
7302
7287
|
);
|
|
7303
7288
|
}
|
|
7304
7289
|
return elements.length > 0 ? elements : null;
|
|
@@ -7306,12 +7291,12 @@ var KoishiElementStreamSession = class {
|
|
|
7306
7291
|
flush() {
|
|
7307
7292
|
if (this.plan.mode === "buffer") return null;
|
|
7308
7293
|
if (this.plan.mode === "edit" && this.text.trim()) {
|
|
7309
|
-
return transformAndEscape([
|
|
7294
|
+
return transformAndEscape([import_koishi17.h.text(this.text)]);
|
|
7310
7295
|
}
|
|
7311
7296
|
let elements = this.splitter.flush();
|
|
7312
7297
|
if (this.options.split && this.options.split !== "none") {
|
|
7313
7298
|
elements = elements.map(
|
|
7314
|
-
(el) => el.type === "message" ? el : (0,
|
|
7299
|
+
(el) => el.type === "message" ? el : (0, import_koishi17.h)("message", el)
|
|
7315
7300
|
);
|
|
7316
7301
|
}
|
|
7317
7302
|
return elements.length > 0 ? elements : null;
|
|
@@ -7330,24 +7315,24 @@ function transformAndEscape(source) {
|
|
|
7330
7315
|
return element;
|
|
7331
7316
|
}
|
|
7332
7317
|
try {
|
|
7333
|
-
return (0,
|
|
7318
|
+
return (0, import_koishi18.parseElements)(element.attrs["content"]);
|
|
7334
7319
|
} catch (e) {
|
|
7335
7320
|
import_koishi_plugin_chatluna9.logger.error(e);
|
|
7336
|
-
return [
|
|
7321
|
+
return [import_koishi17.h.text(element.attrs["content"])];
|
|
7337
7322
|
}
|
|
7338
7323
|
});
|
|
7339
7324
|
}
|
|
7340
7325
|
__name(transformAndEscape, "transformAndEscape");
|
|
7341
7326
|
|
|
7342
7327
|
// src/render/mixed-voice.ts
|
|
7343
|
-
var
|
|
7328
|
+
var import_koishi21 = require("koishi");
|
|
7344
7329
|
var import_koishi_plugin_chatluna10 = require("koishi-plugin-chatluna");
|
|
7345
7330
|
var import_string13 = require("koishi-plugin-chatluna/utils/string");
|
|
7346
7331
|
|
|
7347
7332
|
// src/render/text.ts
|
|
7348
|
-
var
|
|
7333
|
+
var import_koishi19 = require("koishi");
|
|
7349
7334
|
var import_string12 = require("koishi-plugin-chatluna/utils/string");
|
|
7350
|
-
var
|
|
7335
|
+
var import_koishi20 = require("koishi-plugin-chatluna/utils/koishi");
|
|
7351
7336
|
var TextRenderer = class extends Renderer {
|
|
7352
7337
|
static {
|
|
7353
7338
|
__name(this, "TextRenderer");
|
|
@@ -7356,8 +7341,8 @@ var TextRenderer = class extends Renderer {
|
|
|
7356
7341
|
if (options.session != null && options.session.platform === "qq" && options.session.isDirect) {
|
|
7357
7342
|
return {
|
|
7358
7343
|
element: [
|
|
7359
|
-
|
|
7360
|
-
...
|
|
7344
|
+
import_koishi19.h.text((0, import_string12.getMessageContent)(message.content)),
|
|
7345
|
+
...import_koishi19.h.parse("<markdown-qq></markdown-qq>")
|
|
7361
7346
|
]
|
|
7362
7347
|
};
|
|
7363
7348
|
}
|
|
@@ -7370,16 +7355,16 @@ var TextRenderer = class extends Renderer {
|
|
|
7370
7355
|
const element = transformed.shift();
|
|
7371
7356
|
const content = element.attrs["content"];
|
|
7372
7357
|
if (content) {
|
|
7373
|
-
transformed.unshift(
|
|
7358
|
+
transformed.unshift(import_koishi19.h.text(content));
|
|
7374
7359
|
} else {
|
|
7375
7360
|
transformed.unshift(...element.children);
|
|
7376
7361
|
}
|
|
7377
7362
|
}
|
|
7378
7363
|
if (options.split && options.split !== "none") {
|
|
7379
7364
|
transformed = transformed.flatMap((element) => {
|
|
7380
|
-
if (element.type !== "text") return (0,
|
|
7365
|
+
if (element.type !== "text") return (0, import_koishi19.h)("message", element);
|
|
7381
7366
|
return splitText2(element.attrs["content"], options.split).map(
|
|
7382
|
-
(text) => (0,
|
|
7367
|
+
(text) => (0, import_koishi19.h)("message", import_koishi19.h.text(text))
|
|
7383
7368
|
);
|
|
7384
7369
|
});
|
|
7385
7370
|
}
|
|
@@ -7397,7 +7382,7 @@ var TextRenderer = class extends Renderer {
|
|
|
7397
7382
|
createStreamSession(options, plan) {
|
|
7398
7383
|
return new TextStreamSession(options, plan);
|
|
7399
7384
|
}
|
|
7400
|
-
schema =
|
|
7385
|
+
schema = import_koishi19.Schema.const("text").i18n({
|
|
7401
7386
|
"zh-CN": "将回复作为 markdown 进行渲染",
|
|
7402
7387
|
"en-US": "Render as markdown"
|
|
7403
7388
|
});
|
|
@@ -7418,7 +7403,7 @@ var TextStreamSession = class extends BufferedRenderStreamSession {
|
|
|
7418
7403
|
const element = transformed.shift();
|
|
7419
7404
|
const content = element.attrs["content"];
|
|
7420
7405
|
if (content) {
|
|
7421
|
-
transformed.unshift(
|
|
7406
|
+
transformed.unshift(import_koishi19.h.text(content));
|
|
7422
7407
|
} else {
|
|
7423
7408
|
transformed.unshift(...element.children);
|
|
7424
7409
|
}
|
|
@@ -7429,7 +7414,7 @@ var TextStreamSession = class extends BufferedRenderStreamSession {
|
|
|
7429
7414
|
function transformAndEscape2(source, platform = "sandbox") {
|
|
7430
7415
|
return source.flatMap((element) => {
|
|
7431
7416
|
if (element.type === "text") {
|
|
7432
|
-
return (0,
|
|
7417
|
+
return (0, import_koishi20.transformToMarkdown)(element.attrs["content"], platform);
|
|
7433
7418
|
}
|
|
7434
7419
|
return element;
|
|
7435
7420
|
});
|
|
@@ -7473,7 +7458,7 @@ var MixedVoiceRenderer = class extends Renderer {
|
|
|
7473
7458
|
async renderText(messages, options) {
|
|
7474
7459
|
let transformed = transformAndEscape2(messages);
|
|
7475
7460
|
if (options.split && options.split !== "none") {
|
|
7476
|
-
transformed = transformed.map((element) => (0,
|
|
7461
|
+
transformed = transformed.map((element) => (0, import_koishi21.h)("message", element));
|
|
7477
7462
|
}
|
|
7478
7463
|
return {
|
|
7479
7464
|
element: transformed
|
|
@@ -7507,7 +7492,7 @@ var MixedVoiceRenderer = class extends Renderer {
|
|
|
7507
7492
|
)
|
|
7508
7493
|
);
|
|
7509
7494
|
}
|
|
7510
|
-
schema =
|
|
7495
|
+
schema = import_koishi21.Schema.const("mixed-voice").i18n({
|
|
7511
7496
|
"zh-CN": "同时输出语音和文本",
|
|
7512
7497
|
"en-US": "Output both voice and text"
|
|
7513
7498
|
});
|
|
@@ -7527,7 +7512,7 @@ var MixedVoiceStreamSession = class extends BufferedRenderStreamSession {
|
|
|
7527
7512
|
(0, import_string13.transformMessageContentToElements)(text)
|
|
7528
7513
|
);
|
|
7529
7514
|
if (this.options.split && this.options.split !== "none") {
|
|
7530
|
-
result.push(...elements.map((el) => (0,
|
|
7515
|
+
result.push(...elements.map((el) => (0, import_koishi21.h)("message", el)));
|
|
7531
7516
|
} else {
|
|
7532
7517
|
result.push(...elements);
|
|
7533
7518
|
}
|
|
@@ -7537,7 +7522,7 @@ var MixedVoiceStreamSession = class extends BufferedRenderStreamSession {
|
|
|
7537
7522
|
};
|
|
7538
7523
|
|
|
7539
7524
|
// src/render/pure-text.ts
|
|
7540
|
-
var
|
|
7525
|
+
var import_koishi22 = require("koishi");
|
|
7541
7526
|
var import_koishi_plugin_markdown = require("koishi-plugin-markdown");
|
|
7542
7527
|
var import_string14 = require("koishi-plugin-chatluna/utils/string");
|
|
7543
7528
|
var import_he = __toESM(require("he"), 1);
|
|
@@ -7628,10 +7613,10 @@ var PureTextRenderer = class extends Renderer {
|
|
|
7628
7613
|
if (options.split && options.split !== "none") {
|
|
7629
7614
|
return {
|
|
7630
7615
|
element: transformed.flatMap((element) => {
|
|
7631
|
-
if (element.type !== "text") return (0,
|
|
7616
|
+
if (element.type !== "text") return (0, import_koishi22.h)("message", element);
|
|
7632
7617
|
const content = element.attrs["content"];
|
|
7633
7618
|
return splitText2(content, options.split).map(
|
|
7634
|
-
(text) => (0,
|
|
7619
|
+
(text) => (0, import_koishi22.h)("message", import_koishi22.h.text(stripMarkdown(text)))
|
|
7635
7620
|
);
|
|
7636
7621
|
})
|
|
7637
7622
|
};
|
|
@@ -7639,7 +7624,7 @@ var PureTextRenderer = class extends Renderer {
|
|
|
7639
7624
|
return {
|
|
7640
7625
|
element: transformed.map((element) => {
|
|
7641
7626
|
if (element.type !== "text") return element;
|
|
7642
|
-
return
|
|
7627
|
+
return import_koishi22.h.text(stripMarkdown(element.attrs["content"]));
|
|
7643
7628
|
})
|
|
7644
7629
|
};
|
|
7645
7630
|
}
|
|
@@ -7653,7 +7638,7 @@ var PureTextRenderer = class extends Renderer {
|
|
|
7653
7638
|
createStreamSession(options, plan) {
|
|
7654
7639
|
return new PureTextStreamSession(options, plan);
|
|
7655
7640
|
}
|
|
7656
|
-
schema =
|
|
7641
|
+
schema = import_koishi22.Schema.const("pure-text").i18n({
|
|
7657
7642
|
"zh-CN": "将回复渲染为纯文本(去除 markdown 格式)",
|
|
7658
7643
|
"en-US": "Render as pure text (remove markdown format)"
|
|
7659
7644
|
});
|
|
@@ -7666,7 +7651,7 @@ var PureTextStreamSession = class extends BufferedRenderStreamSession {
|
|
|
7666
7651
|
super(options, plan);
|
|
7667
7652
|
}
|
|
7668
7653
|
renderText(text) {
|
|
7669
|
-
return [
|
|
7654
|
+
return [import_koishi22.h.text(stripMarkdown(text))];
|
|
7670
7655
|
}
|
|
7671
7656
|
};
|
|
7672
7657
|
function stripMarkdown(source) {
|
|
@@ -7675,7 +7660,7 @@ function stripMarkdown(source) {
|
|
|
7675
7660
|
__name(stripMarkdown, "stripMarkdown");
|
|
7676
7661
|
|
|
7677
7662
|
// src/render/raw.ts
|
|
7678
|
-
var
|
|
7663
|
+
var import_koishi23 = require("koishi");
|
|
7679
7664
|
var import_string15 = require("koishi-plugin-chatluna/utils/string");
|
|
7680
7665
|
var RawRenderer = class extends Renderer {
|
|
7681
7666
|
static {
|
|
@@ -7684,7 +7669,7 @@ var RawRenderer = class extends Renderer {
|
|
|
7684
7669
|
async render(message, options) {
|
|
7685
7670
|
if (typeof message.content === "string") {
|
|
7686
7671
|
return {
|
|
7687
|
-
element:
|
|
7672
|
+
element: import_koishi23.h.text(message.content)
|
|
7688
7673
|
};
|
|
7689
7674
|
}
|
|
7690
7675
|
return {
|
|
@@ -7701,7 +7686,7 @@ var RawRenderer = class extends Renderer {
|
|
|
7701
7686
|
createStreamSession(options, plan) {
|
|
7702
7687
|
return new RawStreamSession(options, plan);
|
|
7703
7688
|
}
|
|
7704
|
-
schema =
|
|
7689
|
+
schema = import_koishi23.Schema.const("raw").i18n({
|
|
7705
7690
|
"zh-CN": "原始输出",
|
|
7706
7691
|
"en-US": "Raw text"
|
|
7707
7692
|
});
|
|
@@ -7714,7 +7699,7 @@ var RawStreamSession = class extends BufferedRenderStreamSession {
|
|
|
7714
7699
|
super(options, plan);
|
|
7715
7700
|
}
|
|
7716
7701
|
renderText(text) {
|
|
7717
|
-
return [
|
|
7702
|
+
return [import_koishi23.h.text(text)];
|
|
7718
7703
|
}
|
|
7719
7704
|
};
|
|
7720
7705
|
|
|
@@ -7907,7 +7892,7 @@ var ReplyQueue = class {
|
|
|
7907
7892
|
};
|
|
7908
7893
|
|
|
7909
7894
|
// src/render/voice.ts
|
|
7910
|
-
var
|
|
7895
|
+
var import_koishi24 = require("koishi");
|
|
7911
7896
|
var import_koishi_plugin_chatluna11 = require("koishi-plugin-chatluna");
|
|
7912
7897
|
var import_string16 = require("koishi-plugin-chatluna/utils/string");
|
|
7913
7898
|
var VoiceRenderer = class extends Renderer {
|
|
@@ -7927,7 +7912,7 @@ var VoiceRenderer = class extends Renderer {
|
|
|
7927
7912
|
return {
|
|
7928
7913
|
element: await Promise.all(
|
|
7929
7914
|
splitMessages.map(
|
|
7930
|
-
async (text) => (0,
|
|
7915
|
+
async (text) => (0, import_koishi24.h)("message", await this._renderToVoice(text, options))
|
|
7931
7916
|
)
|
|
7932
7917
|
)
|
|
7933
7918
|
};
|
|
@@ -7962,7 +7947,7 @@ var VoiceRenderer = class extends Renderer {
|
|
|
7962
7947
|
)
|
|
7963
7948
|
);
|
|
7964
7949
|
}
|
|
7965
|
-
schema =
|
|
7950
|
+
schema = import_koishi24.Schema.const("voice").i18n({
|
|
7966
7951
|
"zh-CN": "将回复渲染为语音",
|
|
7967
7952
|
"en-US": "Render as voice"
|
|
7968
7953
|
});
|
|
@@ -7978,7 +7963,7 @@ var VoiceStreamSession = class extends BufferedRenderStreamSession {
|
|
|
7978
7963
|
}
|
|
7979
7964
|
async renderText(text) {
|
|
7980
7965
|
return [
|
|
7981
|
-
this.options.split && this.options.split !== "none" ? (0,
|
|
7966
|
+
this.options.split && this.options.split !== "none" ? (0, import_koishi24.h)("message", await this.render(text)) : await this.render(text)
|
|
7982
7967
|
];
|
|
7983
7968
|
}
|
|
7984
7969
|
};
|
|
@@ -8016,24 +8001,12 @@ var DefaultRenderer = class {
|
|
|
8016
8001
|
renderers = {};
|
|
8017
8002
|
async render(message, options = this.defaultOptions) {
|
|
8018
8003
|
try {
|
|
8019
|
-
const result = [];
|
|
8020
8004
|
options = Object.assign({}, this.defaultOptions, options);
|
|
8021
|
-
const
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
result.push({
|
|
8027
|
-
element: (0, import_koishi26.h)(
|
|
8028
|
-
"message",
|
|
8029
|
-
{ forward: true },
|
|
8030
|
-
Array.isArray(elements) ? elements : [elements]
|
|
8031
|
-
)
|
|
8032
|
-
});
|
|
8033
|
-
}
|
|
8034
|
-
}
|
|
8035
|
-
result.push(await currentRenderer.render(message, options));
|
|
8036
|
-
return result;
|
|
8005
|
+
const result = await this.renderAdditionalMessages(message, options);
|
|
8006
|
+
return [
|
|
8007
|
+
...result.map((element) => ({ element })),
|
|
8008
|
+
await this.getRenderer(options.type).render(message, options)
|
|
8009
|
+
];
|
|
8037
8010
|
} catch (e) {
|
|
8038
8011
|
throw new import_error9.ChatLunaError(import_error9.ChatLunaErrorCode.RENDER_ERROR, e);
|
|
8039
8012
|
}
|
|
@@ -8064,12 +8037,11 @@ var DefaultRenderer = class {
|
|
|
8064
8037
|
const rawRenderer = this.getRenderer("raw");
|
|
8065
8038
|
const result = [];
|
|
8066
8039
|
for (const msg of message.additionalReplyMessages) {
|
|
8067
|
-
const elements = await rawRenderer.render(msg, options).then((r) => r.element);
|
|
8068
8040
|
result.push([
|
|
8069
|
-
(0,
|
|
8041
|
+
(0, import_koishi25.h)(
|
|
8070
8042
|
"message",
|
|
8071
8043
|
{ forward: true },
|
|
8072
|
-
|
|
8044
|
+
(await rawRenderer.render(msg, options)).element
|
|
8073
8045
|
)
|
|
8074
8046
|
]);
|
|
8075
8047
|
}
|
|
@@ -8093,7 +8065,7 @@ var DefaultRenderer = class {
|
|
|
8093
8065
|
}
|
|
8094
8066
|
this.ctx.schema.set(
|
|
8095
8067
|
"output-mode",
|
|
8096
|
-
|
|
8068
|
+
import_koishi25.Schema.union(this._getAllRendererScheme())
|
|
8097
8069
|
);
|
|
8098
8070
|
}
|
|
8099
8071
|
_getAllRendererScheme() {
|
|
@@ -8153,7 +8125,7 @@ function setupEntryPoint(ctx, config, disposables) {
|
|
|
8153
8125
|
setupMiddleware(ctx2);
|
|
8154
8126
|
});
|
|
8155
8127
|
}, "entryPointPlugin");
|
|
8156
|
-
const entryPointDisposable = (0,
|
|
8128
|
+
const entryPointDisposable = (0, import_koishi27.forkScopeToDisposable)(
|
|
8157
8129
|
ctx.plugin(
|
|
8158
8130
|
{
|
|
8159
8131
|
apply: entryPointPlugin,
|
|
@@ -8204,7 +8176,7 @@ function setupMiddleware(ctx) {
|
|
|
8204
8176
|
__name(setupMiddleware, "setupMiddleware");
|
|
8205
8177
|
function setupLogger(config) {
|
|
8206
8178
|
if (config.isLog) {
|
|
8207
|
-
(0, import_logger7.setLoggerLevel)(
|
|
8179
|
+
(0, import_logger7.setLoggerLevel)(import_koishi26.Logger.DEBUG);
|
|
8208
8180
|
}
|
|
8209
8181
|
}
|
|
8210
8182
|
__name(setupLogger, "setupLogger");
|
|
@@ -8224,7 +8196,7 @@ function setupProxy(ctx, config) {
|
|
|
8224
8196
|
}
|
|
8225
8197
|
__name(setupProxy, "setupProxy");
|
|
8226
8198
|
function setupServices(ctx, config, disposables) {
|
|
8227
|
-
disposables.push((0,
|
|
8199
|
+
disposables.push((0, import_koishi27.forkScopeToDisposable)(ctx.plugin(import_chat2.ChatLunaService, config)));
|
|
8228
8200
|
}
|
|
8229
8201
|
__name(setupServices, "setupServices");
|
|
8230
8202
|
function setupPermissions(ctx, disposables) {
|
|
@@ -8295,7 +8267,7 @@ async function setupAutoArchive(ctx, config) {
|
|
|
8295
8267
|
await execute();
|
|
8296
8268
|
ctx.setInterval(async () => {
|
|
8297
8269
|
await execute();
|
|
8298
|
-
},
|
|
8270
|
+
}, import_koishi26.Time.minute * 5);
|
|
8299
8271
|
}
|
|
8300
8272
|
__name(setupAutoArchive, "setupAutoArchive");
|
|
8301
8273
|
async function setupAutoPurgeArchive(ctx, config) {
|
|
@@ -8358,7 +8330,7 @@ async function setupAutoPurgeArchive(ctx, config) {
|
|
|
8358
8330
|
await execute();
|
|
8359
8331
|
ctx.setInterval(async () => {
|
|
8360
8332
|
await execute();
|
|
8361
|
-
},
|
|
8333
|
+
}, import_koishi26.Time.minute * 10);
|
|
8362
8334
|
}
|
|
8363
8335
|
__name(setupAutoPurgeArchive, "setupAutoPurgeArchive");
|
|
8364
8336
|
async function dedupeConstraintNames(ctx) {
|