dsh-qqbot-muu 0.1.20 → 0.1.21
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/CHANGELOG.md +168 -154
- package/client/qqbot-settings.js +13401 -13380
- package/dist/config.js +573 -581
- package/dist/features/contextless-store.js +247 -247
- package/dist/features/four-source.js +338 -336
- package/dist/features/group-join-request.js +289 -287
- package/dist/features/local-models.js +1494 -1467
- package/dist/features/style-layer.js +501 -498
- package/dist/features/thinking-log.js +71 -69
- package/dist/gateway/bootstrap.js +1704 -1652
- package/dist/model/settings-reader.js +193 -102
- package/dist/shared/paths.js +128 -0
- package/dist/shared/settings-io.js +79 -83
- package/dshqqbot/.qqbot-extensions/inbound/00-vision.mjs +111 -0
- package/dshqqbot/.qqbot-extensions/inbound/aa-memory-recall.mjs +802 -794
- package/dshqqbot/.qqbot-extensions/inbound/az-feedback.mjs +113 -115
- package/dshqqbot/.qqbot-extensions/inbound/local-answer.mjs +689 -568
- package/dshqqbot/.qqbot-extensions/lib/local-llm.mjs +455 -444
- package/dshqqbot/.qqbot-extensions/lib/memory-agent.mjs +930 -928
- package/dshqqbot/.qqbot-extensions/lib/memory-core.mjs +537 -537
- package/dshqqbot/.qqbot-extensions/lib/memory-db.mjs +2476 -2245
- package/dshqqbot/.qqbot-extensions/lib/memory-hippo.mjs +18 -0
- package/dshqqbot/.qqbot-extensions/lib/memory.mjs +191 -186
- package/dshqqbot/.qqbot-extensions/lib/scope-util.mjs +84 -0
- package/dshqqbot/.qqbot-extensions/outbound/aa-sanitize.mjs +158 -154
- package/dshqqbot/.qqbot-extensions/outbound/memory-agent.mjs +121 -130
- package/dshqqbot/.qqbot-extensions/outbound/turn-memory.mjs +92 -101
- package/dshqqbot/.qqbot-extensions/tools/memory.mjs +178 -120
- package/dshqqbot/.qqbot-extensions/vendor/abogus/test-abogus.mjs +128 -126
- package/package.json +119 -118
- package/scripts/__pycache__/fan-mode.cpython-311.pyc +0 -0
- package/scripts/__pycache__/memory-audit.cpython-311.pyc +0 -0
- package/scripts/__pycache__/qq-ip-sync.cpython-311.pyc +0 -0
- package/scripts/__pycache__/qq-whitelist.cpython-311.pyc +0 -0
- package/scripts/ai-toolkit.py +607 -478
- package/scripts/chat-archive/__pycache__/build-sft-v4.cpython-311.pyc +0 -0
- package/scripts/chat-archive/__pycache__/build-sft.cpython-311.pyc +0 -0
- package/scripts/chat-archive/build-sft-v4.py +566 -0
- package/scripts/chat-archive/build-sft.py +390 -0
- package/scripts/chat-archive/eval-sft.py +155 -0
- package/scripts/chat-archive/extract-memory.py +143 -0
- package/scripts/chat-archive/inventory.py +182 -0
- package/scripts/chat-archive/merge-sft.py +114 -0
- package/scripts/chat-archive/qce-pull.py +217 -0
- package/scripts/chat-archive/qqheader.py +110 -0
- package/scripts/chat-archive/qqkey2.py +113 -0
- package/scripts/chat-archive/qqprobe.py +153 -0
- package/scripts/chat-archive/screen-collect.py +163 -0
- package/scripts/chat-archive/sqlcipher_probe.py +444 -0
- package/scripts/episode.py +529 -0
- package/scripts/fan-curve.py +218 -0
- package/scripts/fan-guard.cmd +8 -0
- package/scripts/fan-mode.py +380 -263
- package/scripts/gen-image.py +420 -413
- package/scripts/gen-video.py +186 -178
- package/scripts/hw-profile.py +175 -0
- package/scripts/media-enhance.py +402 -0
- package/scripts/memory-audit.py +581 -0
- package/scripts/migrate-scope.mjs +140 -139
- package/scripts/qq-connect-login.py +133 -0
- package/scripts/qq-ip-sync-hidden.vbs +5 -0
- package/scripts/qq-ip-sync.py +300 -0
- package/scripts/qq-whitelist.py +71 -0
- package/scripts/release-all.mjs +636 -509
- package/scripts/release-check.mjs +244 -226
- package/scripts/secure-room/index.html +334 -0
- package/scripts/secure-room/server.py +582 -0
- package/scripts/stickers/auto-tag.mjs +161 -0
- package/scripts/train/__pycache__/train-lora.cpython-311.pyc +0 -0
- package/scripts/train/gguf-quantize.py +92 -0
- package/scripts/train/gguf-to-hf.py +112 -0
- package/scripts/train/merge-lora.py +51 -0
- package/scripts/train/probe-mirrors.sh +12 -0
- package/scripts/train/probe-mirrors2.sh +20 -0
- package/scripts/train/setup-wsl.sh +23 -0
- package/scripts/train/setup-wsl2.sh +25 -0
- package/scripts/train/setup-wsl3.sh +22 -0
- package/scripts/train/setup-wsl4.sh +22 -0
- package/scripts/train/train-lora.py +319 -0
- package/dist/_backup_ctx_20261125_183653/dist/config.d.ts +0 -473
- package/dist/_backup_ctx_20261125_183653/dist/config.js +0 -450
- package/dist/_backup_ctx_20261125_183653/dist/features/contextless-trim.js +0 -304
- package/dist/_backup_ctx_20261125_183653/dist/session/session-manager.js +0 -1588
- package/dist/_backup_ctx_20261125_183653/dist/transport/inbound.js +0 -1567
- package/dist/_backup_ctx_20261125_183653/dist/transport/outbound.js +0 -647
- package/scripts/__pycache__/ai-mode.cpython-311.pyc +0 -0
- package/scripts/__pycache__/ai-toolkit.cpython-311.pyc +0 -0
- package/scripts/__pycache__/comfy_gen.cpython-311.pyc +0 -0
- package/scripts/__pycache__/gen-image.cpython-311.pyc +0 -0
- package/scripts/__pycache__/gen-video.cpython-311.pyc +0 -0
- package/scripts/__pycache__/model-registry.cpython-311.pyc +0 -0
- package/scripts/__pycache__/purge-standby.cpython-311.pyc +0 -0
|
@@ -1,115 +1,113 @@
|
|
|
1
|
-
import { existsSync as __existsSync } from 'node:fs'
|
|
2
|
-
const __repoRoot = (() => {
|
|
3
|
-
let cached = ''
|
|
4
|
-
const norm = (p) => String(p || '').split(String.fromCharCode(92)).join('/')
|
|
5
|
-
return () => {
|
|
6
|
-
if (cached) return cached
|
|
7
|
-
const cands = []
|
|
8
|
-
const env = String(process.env.QQBOT_ROOT || process.env.QQBOT_REPO_ROOT || '').trim()
|
|
9
|
-
if (env) cands.push(norm(env))
|
|
10
|
-
try {
|
|
11
|
-
let here = decodeURIComponent(new URL('.', import.meta.url).pathname)
|
|
12
|
-
if (here[0] === '/' && here[2] === ':') here = here.slice(1)
|
|
13
|
-
here = norm(here).replace(/\/+$/, '')
|
|
14
|
-
let d = here
|
|
15
|
-
for (let i = 0; i < 6; i += 1) {
|
|
16
|
-
if (!d) break
|
|
17
|
-
cands.push(d)
|
|
18
|
-
const k = d.lastIndexOf('/')
|
|
19
|
-
d = k > 0 ? d.slice(0, k) : ''
|
|
20
|
-
}
|
|
21
|
-
} catch { /* noop */ }
|
|
22
|
-
try { cands.push(norm(process.cwd())) } catch { /* noop */ }
|
|
23
|
-
for (const c of cands) {
|
|
24
|
-
try {
|
|
25
|
-
if (c && (__existsSync(c + '/qqbot-mod/muu-shared.mjs') || __existsSync(c + '/dshqqbot'))) { cached = c; return cached }
|
|
26
|
-
} catch { /* noop */ }
|
|
27
|
-
}
|
|
28
|
-
cached = norm(cands.find(Boolean) || '.')
|
|
29
|
-
return cached
|
|
30
|
-
}
|
|
31
|
-
})()
|
|
32
|
-
/**
|
|
33
|
-
* az-feedback.mjs — 把“用户对刚才回复的真实评价”收进记忆,喂给自我反思
|
|
34
|
-
*
|
|
35
|
-
* 背景(2026-11-07):runSelfReflection 只吃 insight/growth,等于只吃自己总结的
|
|
36
|
-
* 正面/中性心得,用户说“你刚才太凶了 / 别反问”这类真实反馈根本没进闭环。
|
|
37
|
-
*
|
|
38
|
-
* 这里只做一件事:识别**直接指向她**的负反馈,连同她上一条回复一起记为
|
|
39
|
-
* kind='insight', subj='feedback'(GLOBAL_SCOPE)。每天一次的本地反思会优先读它。
|
|
40
|
-
*
|
|
41
|
-
* 安全契约:
|
|
42
|
-
* · 严格正则 + 长度上限,宁漏不误记;
|
|
43
|
-
* · 同 scope 10 分钟最多记一条,避免刷屏式重复;
|
|
44
|
-
* · 任何异常只记日志并 next(),不影响聊天。
|
|
45
|
-
*/
|
|
46
|
-
import {
|
|
47
|
-
cleanChatText, getChatState, loadConfig, queryChat, remember, setChatState,
|
|
48
|
-
} from '../lib/memory.mjs';
|
|
49
|
-
import { GLOBAL_SCOPE } from '../lib/profile-core.mjs';
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/(
|
|
56
|
-
/(
|
|
57
|
-
/(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return next();
|
|
115
|
-
}
|
|
1
|
+
import { existsSync as __existsSync } from 'node:fs'
|
|
2
|
+
const __repoRoot = (() => {
|
|
3
|
+
let cached = ''
|
|
4
|
+
const norm = (p) => String(p || '').split(String.fromCharCode(92)).join('/')
|
|
5
|
+
return () => {
|
|
6
|
+
if (cached) return cached
|
|
7
|
+
const cands = []
|
|
8
|
+
const env = String(process.env.QQBOT_ROOT || process.env.QQBOT_REPO_ROOT || '').trim()
|
|
9
|
+
if (env) cands.push(norm(env))
|
|
10
|
+
try {
|
|
11
|
+
let here = decodeURIComponent(new URL('.', import.meta.url).pathname)
|
|
12
|
+
if (here[0] === '/' && here[2] === ':') here = here.slice(1)
|
|
13
|
+
here = norm(here).replace(/\/+$/, '')
|
|
14
|
+
let d = here
|
|
15
|
+
for (let i = 0; i < 6; i += 1) {
|
|
16
|
+
if (!d) break
|
|
17
|
+
cands.push(d)
|
|
18
|
+
const k = d.lastIndexOf('/')
|
|
19
|
+
d = k > 0 ? d.slice(0, k) : ''
|
|
20
|
+
}
|
|
21
|
+
} catch { /* noop */ }
|
|
22
|
+
try { cands.push(norm(process.cwd())) } catch { /* noop */ }
|
|
23
|
+
for (const c of cands) {
|
|
24
|
+
try {
|
|
25
|
+
if (c && (__existsSync(c + '/qqbot-mod/muu-shared.mjs') || __existsSync(c + '/dshqqbot'))) { cached = c; return cached }
|
|
26
|
+
} catch { /* noop */ }
|
|
27
|
+
}
|
|
28
|
+
cached = norm(cands.find(Boolean) || '.')
|
|
29
|
+
return cached
|
|
30
|
+
}
|
|
31
|
+
})()
|
|
32
|
+
/**
|
|
33
|
+
* az-feedback.mjs — 把“用户对刚才回复的真实评价”收进记忆,喂给自我反思
|
|
34
|
+
*
|
|
35
|
+
* 背景(2026-11-07):runSelfReflection 只吃 insight/growth,等于只吃自己总结的
|
|
36
|
+
* 正面/中性心得,用户说“你刚才太凶了 / 别反问”这类真实反馈根本没进闭环。
|
|
37
|
+
*
|
|
38
|
+
* 这里只做一件事:识别**直接指向她**的负反馈,连同她上一条回复一起记为
|
|
39
|
+
* kind='insight', subj='feedback'(GLOBAL_SCOPE)。每天一次的本地反思会优先读它。
|
|
40
|
+
*
|
|
41
|
+
* 安全契约:
|
|
42
|
+
* · 严格正则 + 长度上限,宁漏不误记;
|
|
43
|
+
* · 同 scope 10 分钟最多记一条,避免刷屏式重复;
|
|
44
|
+
* · 任何异常只记日志并 next(),不影响聊天。
|
|
45
|
+
*/
|
|
46
|
+
import {
|
|
47
|
+
cleanChatText, getChatState, loadConfig, queryChat, remember, setChatState,
|
|
48
|
+
} from '../lib/memory.mjs';
|
|
49
|
+
import { GLOBAL_SCOPE } from '../lib/profile-core.mjs';
|
|
50
|
+
import { scopeOfMessage } from '../lib/scope-util.mjs';
|
|
51
|
+
|
|
52
|
+
export const name = 'az-feedback';
|
|
53
|
+
|
|
54
|
+
const FB_RE = [
|
|
55
|
+
/(你|小蓝|肥鱼|鲸)[^\n]{0,14}(刚才|刚刚|上一条|上一句|这次|这话|说话|回复|接话|语气|态度)[^\n]{0,16}(凶|冲|敷衍|机械|说教|反讽|反问|抬杠|听不懂|不像人|过头|太冷|奇怪|差|不好|别扭|观感)/,
|
|
56
|
+
/(别|不要|以后别)[^\n]{0,12}(反问|反讽|抬杠|说教|复述|总结|抢话|自作聪明|阴阳|阴阳怪气|冷嘲热讽|杠我)/,
|
|
57
|
+
/(观感|听起来|看起来)[^\n]{0,10}(差|不好|怪|别扭|像客服|不像人)/,
|
|
58
|
+
/(答非所问|没听懂|听不懂|你没理解|理解错|会错意|不是问你|我在说自己|别接我的)/,
|
|
59
|
+
// 2026-11-07:分享/自嘲被反向嘲讽是最伤观感的一类,必须进反思
|
|
60
|
+
/(我在分享|只是分享|我在吐槽|我在自嘲|我自嘲[^\n]{0,8}你还|你杠我|你阴阳我|你嘲讽我)/,
|
|
61
|
+
/(别(?:再)?(?:拿我|开我)玩笑|别(?:再)?(?:嘲讽|阴阳|杠)我)/,
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
function dataRootOf() {
|
|
65
|
+
const env = String(process.env.QQBOT_MEMORY_DATA_ROOT || '').trim();
|
|
66
|
+
if (env) return env;
|
|
67
|
+
try {
|
|
68
|
+
const cfg = loadConfig(__repoRoot() + "/dshqqbot");
|
|
69
|
+
return (cfg && cfg.dataRoot) || __repoRoot() + "/dshqqbot";
|
|
70
|
+
} catch {
|
|
71
|
+
return __repoRoot() + "/dshqqbot";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function scopeOf(ctx) {
|
|
76
|
+
return scopeOfMessage(ctx?.message);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** 纯函数:这条消息是不是在评价她刚才的回复 */
|
|
80
|
+
export function isFeedback(text) {
|
|
81
|
+
const s = String(text == null ? '' : text).trim();
|
|
82
|
+
if (s.length < 3 || s.length > 120) return false;
|
|
83
|
+
return FB_RE.some((re) => re.test(s));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export async function onInbound(ctx, next) {
|
|
87
|
+
try {
|
|
88
|
+
const m = ctx?.message || {};
|
|
89
|
+
if (m.dir === 'out' || m.fromSelf === true) return next();
|
|
90
|
+
const scope = scopeOf(ctx);
|
|
91
|
+
if (!scope) return next();
|
|
92
|
+
const root = dataRootOf();
|
|
93
|
+
const text = cleanChatText(String(m.content ?? ctx?.text ?? '')).slice(0, 120);
|
|
94
|
+
if (!isFeedback(text)) return next();
|
|
95
|
+
|
|
96
|
+
const key = 'feedback:last:' + scope;
|
|
97
|
+
const st = getChatState(root, key) || {};
|
|
98
|
+
if (Date.now() - Number(st.ts || 0) < 10 * 60 * 1000) return next();
|
|
99
|
+
|
|
100
|
+
const lastOut = (queryChat(root, scope, { limit: 1, dir: 'out' }) || [])
|
|
101
|
+
.map((r) => cleanChatText(String(r?.text || '')))
|
|
102
|
+
.find(Boolean) || '';
|
|
103
|
+
const body = `用户反馈:${text}${lastOut ? `(我上一条:${lastOut.slice(0, 60)})` : ''}`;
|
|
104
|
+
const r = await remember(root, GLOBAL_SCOPE, { text: body, kind: 'insight', subj: 'feedback' });
|
|
105
|
+
if (r && r.ok) {
|
|
106
|
+
setChatState(root, key, { ts: Date.now() });
|
|
107
|
+
ctx?.logger?.info?.('[feedback] 已记录一条用户反馈');
|
|
108
|
+
}
|
|
109
|
+
} catch (e) {
|
|
110
|
+
ctx?.logger?.debug?.(`[feedback] 失败(已忽略): ${e?.message || e}`);
|
|
111
|
+
}
|
|
112
|
+
return next();
|
|
113
|
+
}
|