From c54f437ae98644d4e618cd0cc1eb7521bf017723 Mon Sep 17 00:00:00 2001
From: "Begonia, HE" <163421589+BegoniaHe@users.noreply.github.com>
Date: Mon, 25 Aug 2025 19:59:05 +0200
Subject: [PATCH 1/2] Update index.ts
---
src/index.ts | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/index.ts b/src/index.ts
index 4e170ea..4857ec5 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -409,8 +409,8 @@ function main() {
return ret;
}
default: {
- if (s.length > 20) {
- seal.replyToSender(ctx, msg, '设定过长,请控制在20字以内');
+ if (s.length > 65536) {
+ seal.replyToSender(ctx, msg, '设定过长,请控制在65536字以内');
return ret;
}
ai2.memory.persona = s;
@@ -477,8 +477,8 @@ function main() {
return ret;
}
default: {
- if (s.length > 30) {
- seal.replyToSender(ctx, msg, '设定过长,请控制在30字以内');
+ if (s.length > 65536) {
+ seal.replyToSender(ctx, msg, '设定过长,请控制在65536字以内');
return ret;
}
ai.memory.persona = s;
From e5f9243ceb5475e302f03f2294e942d1cdacd1ff Mon Sep 17 00:00:00 2001
From: "Begonia, HE" <163421589+BegoniaHe@users.noreply.github.com>
Date: Sat, 30 Aug 2025 15:38:00 +0200
Subject: [PATCH 2/2] Removes thinking chains and comments from AI responses
Filters out ... tags and HTML comments from AI-generated text to clean up the final output before processing replies.
Ensures users receive clean, focused responses without internal AI reasoning artifacts or development comments.
---
src/utils/utils_string.ts | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/utils/utils_string.ts b/src/utils/utils_string.ts
index 1c109ed..c0b4a8c 100644
--- a/src/utils/utils_string.ts
+++ b/src/utils/utils_string.ts
@@ -6,6 +6,16 @@ import { ConfigManager } from "../config/config";
import { transformMsgIdBack } from "./utils";
import { AI } from "../AI/AI";
+function removeThinkingChains(text: string): string {
+ // 移除 ... 标签(大小写不敏感,支持多行)
+ text = text.replace(//gi, '');
+
+ // 移除 注释(支持多行)
+ text = text.replace(//g, '');
+
+ return text;
+}
+
export function transformTextToArray(s: string): { type: string, data: { [key: string]: string } }[] {
const segments = s.split(/(\[CQ:.*?\])/).filter(segment => segment);
const messageArray: { type: string, data: { [key: string]: string } }[] = [];
@@ -78,6 +88,9 @@ export function transformArrayToText(messageArray: { type: string, data: { [key:
}
export async function handleReply(ctx: seal.MsgContext, msg: seal.Message, ai: AI, s: string): Promise<{ contextArray: string[], replyArray: string[], images: Image[] }> {
+ // 移除思维链内容
+ s = removeThinkingChains(s);
+
const { replymsg, isTrim } = ConfigManager.reply;
// 分离AI臆想出来的多轮对话