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
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""fan-curve.py —— 把 FanControl 的「固定占空比」改成「温度曲线」。
|
|
3
|
+
|
|
4
|
+
背景(2026-12-02 主人反馈):
|
|
5
|
+
原来 4 个风扇全是 ManualControl=True + 固定值(CPU 38%、进风 26%、出风 26%、GPU 24%),
|
|
6
|
+
FanCurves 是空数组 —— 也就是说根本不是曲线:升温不升速、降温也不降速。
|
|
7
|
+
这里生成 graph 曲线并挂到对应风扇上,同时把 ManualControl 关掉。
|
|
8
|
+
|
|
9
|
+
安全策略:
|
|
10
|
+
· 动手前一定备份 userConfig.json(FanControl 目录 + config/fan/ 各一份)
|
|
11
|
+
· MinimumPercent 一律 ≥ 25:即使曲线读不到温度,也不会把风扇压到 0
|
|
12
|
+
· --restore 用最近一份备份回滚
|
|
13
|
+
|
|
14
|
+
⚠️ 实测结论(2026-12-02):FanControl 的 graph 曲线是 UI 里创建时序列化的内部结构,
|
|
15
|
+
用 --config 从命令行注入 **不生效**(做过对照实验:写成恒定 40% 的曲线,风扇仍是 33%)。
|
|
16
|
+
所以本脚本现在只用来**产出一份参数表**(config/fan/curve.json),真正落地要在
|
|
17
|
+
FanControl 界面里点「新建曲线 → 图形 → 选温度源 → 填下面的点」。--apply 仅作实验保留。
|
|
18
|
+
|
|
19
|
+
用法:
|
|
20
|
+
python scripts/fan-curve.py --dry-run # 只生成 config/fan/curve.json,不动运行中的实例
|
|
21
|
+
python scripts/fan-curve.py --apply # 生成 + FanControl --config 热加载
|
|
22
|
+
python scripts/fan-curve.py --status # 看当前温度/风扇/期望占空比
|
|
23
|
+
python scripts/fan-curve.py --restore # 回滚到最近备份
|
|
24
|
+
"""
|
|
25
|
+
import argparse
|
|
26
|
+
import json
|
|
27
|
+
import os
|
|
28
|
+
import shutil
|
|
29
|
+
import subprocess
|
|
30
|
+
import sys
|
|
31
|
+
import time
|
|
32
|
+
from datetime import datetime
|
|
33
|
+
|
|
34
|
+
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
35
|
+
FC_DIR = r"C:\Program Files (x86)\FanControl"
|
|
36
|
+
FC_EXE = os.path.join(FC_DIR, "FanControl.exe")
|
|
37
|
+
FC_USER_CFG = os.path.join(FC_DIR, "Configurations", "userConfig.json")
|
|
38
|
+
CFG_DIR = os.path.join(ROOT, "config", "fan")
|
|
39
|
+
OUT_CFG = os.path.join(CFG_DIR, "curve.json")
|
|
40
|
+
CNW = 0x08000000
|
|
41
|
+
|
|
42
|
+
# 同一设备下的温度传感器一般与 control 同路径,只是段名从 control 换成 temperature
|
|
43
|
+
CURVES = [
|
|
44
|
+
# key, 控制卡匹配(字段, 子串), 曲线名, 温度传感器标识, 曲线点(℃,%)
|
|
45
|
+
("cpu", "name", "CPU Fan", "CPU 温度曲线", "/lpc/nct6797d/temperature/0",
|
|
46
|
+
[[35, 30], [50, 40], [62, 52], [70, 65], [80, 85]]),
|
|
47
|
+
("in", "name", "进风", "进风 温度曲线", "/lpc/nct6797d/temperature/1",
|
|
48
|
+
[[30, 25], [45, 32], [60, 45], [70, 60], [80, 75]]),
|
|
49
|
+
("out", "name", "出风", "出风 温度曲线", "/lpc/nct6797d/temperature/2",
|
|
50
|
+
[[30, 25], [45, 35], [60, 50], [70, 65], [80, 80]]),
|
|
51
|
+
("gpu", "identifier", "NVApiWrapper", "GPU 温度曲线", "NVApiWrapper/0-TU102-A/temperature/0",
|
|
52
|
+
[[40, 25], [55, 35], [65, 50], [72, 65], [80, 80], [86, 90]]),
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def log(m):
|
|
57
|
+
print("[fan-curve] %s" % m, flush=True)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def smi(*fields):
|
|
61
|
+
try:
|
|
62
|
+
out = subprocess.run(["nvidia-smi", "--query-gpu=" + ",".join(fields),
|
|
63
|
+
"--format=csv,noheader,nounits"],
|
|
64
|
+
capture_output=True, text=True, timeout=15, creationflags=CNW)
|
|
65
|
+
row = (out.stdout or "").strip().splitlines()
|
|
66
|
+
return [x.strip() for x in row[0].split(",")] if row else None
|
|
67
|
+
except Exception:
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def load_cfg():
|
|
72
|
+
with open(FC_USER_CFG, "r", encoding="utf-8-sig") as f:
|
|
73
|
+
return json.load(f)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def backup():
|
|
77
|
+
os.makedirs(CFG_DIR, exist_ok=True)
|
|
78
|
+
ts = datetime.now().strftime("%Y%m%d-%H%M%S")
|
|
79
|
+
a = os.path.join(CFG_DIR, "backup-userConfig-%s.json" % ts)
|
|
80
|
+
shutil.copyfile(FC_USER_CFG, a)
|
|
81
|
+
b = os.path.join(FC_DIR, "Configurations", "userConfig.before-curve-%s.json" % ts)
|
|
82
|
+
try:
|
|
83
|
+
shutil.copyfile(FC_USER_CFG, b)
|
|
84
|
+
except Exception as e:
|
|
85
|
+
log("写入 FanControl 目录备份失败(不影响,仓库里还有一份): %s" % e)
|
|
86
|
+
b = ""
|
|
87
|
+
return a, b
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def build(flat=None):
|
|
91
|
+
cfg = load_cfg()
|
|
92
|
+
fc = cfg["FanControl"]
|
|
93
|
+
curves = fc.setdefault("FanCurves", [])
|
|
94
|
+
by_name = {c.get("Name"): c for c in curves if isinstance(c, dict)}
|
|
95
|
+
matched = []
|
|
96
|
+
for key, how, pat, name, sensor, points in CURVES:
|
|
97
|
+
if flat:
|
|
98
|
+
points = [[30, flat], [60, flat]]
|
|
99
|
+
curve = {
|
|
100
|
+
"Name": name,
|
|
101
|
+
"IsHidden": False,
|
|
102
|
+
"CommandMode": 2, # 2 = graph(0=fixed,1=linear)
|
|
103
|
+
# Points 的元素是 System.Windows.Point,Newtonsoft 走 TypeConverter → 必须是 "x,y" 字符串
|
|
104
|
+
"Points": ["%s,%s" % (int(t), int(p)) for t, p in points],
|
|
105
|
+
"SelectedTempSensors": [{"Identifier": sensor}],
|
|
106
|
+
}
|
|
107
|
+
if name in by_name:
|
|
108
|
+
by_name[name].update(curve)
|
|
109
|
+
else:
|
|
110
|
+
curves.append(curve)
|
|
111
|
+
for card in fc["Controls"]:
|
|
112
|
+
hay = (card.get("Identifier") if how == "identifier" else card.get("NickName")) or ""
|
|
113
|
+
if pat.lower() not in hay.lower():
|
|
114
|
+
continue
|
|
115
|
+
card["Enable"] = True
|
|
116
|
+
card["ManualControl"] = False
|
|
117
|
+
# FanControl 的 SelectedFanCurve 存的是**曲线对象本体**,不是名字;
|
|
118
|
+
# 写成字符串会让整个配置反序列化失败(log.txt: "Current JsonReader item is not an object: String")
|
|
119
|
+
card["SelectedFanCurve"] = json.loads(json.dumps(curve))
|
|
120
|
+
card["MinimumPercent"] = max(int(card.get("MinimumPercent") or 0), 25)
|
|
121
|
+
card["MaximumPercent"] = 100
|
|
122
|
+
card["SelectedStart"] = 0
|
|
123
|
+
card["SelectedStop"] = 0
|
|
124
|
+
matched.append((key, card.get("NickName"), points))
|
|
125
|
+
cfg["FanControl"] = fc
|
|
126
|
+
os.makedirs(CFG_DIR, exist_ok=True)
|
|
127
|
+
with open(OUT_CFG, "w", encoding="utf-8") as f:
|
|
128
|
+
json.dump(cfg, f, ensure_ascii=False, indent=2)
|
|
129
|
+
return OUT_CFG, matched
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def expected(key, temp):
|
|
133
|
+
pts = next((p for k, _h, _pat, _n, _s, p in CURVES if k == key), None)
|
|
134
|
+
if not pts or temp is None:
|
|
135
|
+
return None
|
|
136
|
+
if temp <= pts[0][0]:
|
|
137
|
+
return pts[0][1]
|
|
138
|
+
for (t0, p0), (t1, p1) in zip(pts, pts[1:]):
|
|
139
|
+
if t0 <= temp <= t1:
|
|
140
|
+
return round(p0 + (p1 - p0) * (temp - t0) / max(1e-6, t1 - t0))
|
|
141
|
+
return pts[-1][1]
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def apply_cfg(path):
|
|
145
|
+
if not os.path.exists(FC_EXE):
|
|
146
|
+
log("找不到 FanControl.exe")
|
|
147
|
+
return 3
|
|
148
|
+
try:
|
|
149
|
+
p = subprocess.Popen([FC_EXE, "-c", path], creationflags=CNW)
|
|
150
|
+
p.wait(timeout=25)
|
|
151
|
+
except Exception as e:
|
|
152
|
+
log("--config 调用失败: %s" % e)
|
|
153
|
+
return 3
|
|
154
|
+
return 0
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def status():
|
|
158
|
+
row = smi("temperature.gpu", "fan.speed", "power.draw")
|
|
159
|
+
if row:
|
|
160
|
+
t, f, p = row[0], row[1], row[2]
|
|
161
|
+
exp = expected("gpu", float(t))
|
|
162
|
+
print("gpu : %s C fan %s%% 期望(GPU 曲线) %s%% power %s W" % (t, f, exp, p))
|
|
163
|
+
else:
|
|
164
|
+
print("nvidia-smi 不可用")
|
|
165
|
+
print("cfg : %s" % (OUT_CFG if os.path.exists(OUT_CFG) else "未生成"))
|
|
166
|
+
try:
|
|
167
|
+
j = load_cfg()
|
|
168
|
+
for c in j["FanControl"]["Controls"]:
|
|
169
|
+
print(" %-34s manual=%-5s curve=%s min=%s" %
|
|
170
|
+
(c.get("NickName"), c.get("ManualControl"), c.get("SelectedFanCurve"),
|
|
171
|
+
c.get("MinimumPercent")))
|
|
172
|
+
print("curves: %s" % ", ".join(x.get("Name", "?") for x in j["FanControl"]["FanCurves"]))
|
|
173
|
+
except Exception as e:
|
|
174
|
+
print("读配置失败: %s" % e)
|
|
175
|
+
return 0
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def restore():
|
|
179
|
+
cands = sorted([f for f in os.listdir(CFG_DIR) if f.startswith("backup-userConfig-")])
|
|
180
|
+
if not cands:
|
|
181
|
+
log("没有备份可回滚")
|
|
182
|
+
return 2
|
|
183
|
+
src = os.path.join(CFG_DIR, cands[-1])
|
|
184
|
+
shutil.copyfile(src, FC_USER_CFG)
|
|
185
|
+
log("已回滚: %s -> userConfig.json" % cands[-1])
|
|
186
|
+
return apply_cfg(FC_USER_CFG)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def main():
|
|
190
|
+
ap = argparse.ArgumentParser()
|
|
191
|
+
ap.add_argument("--dry-run", action="store_true")
|
|
192
|
+
ap.add_argument("--apply", action="store_true")
|
|
193
|
+
ap.add_argument("--status", action="store_true")
|
|
194
|
+
ap.add_argument("--test-percent", type=int, default=0,
|
|
195
|
+
help="把所有曲线压成恒定值做对照实验(验证曲线是否真的生效)")
|
|
196
|
+
ap.add_argument("--restore", action="store_true")
|
|
197
|
+
a = ap.parse_args()
|
|
198
|
+
if a.status:
|
|
199
|
+
return status()
|
|
200
|
+
if a.restore:
|
|
201
|
+
return restore()
|
|
202
|
+
ba, bb = backup()
|
|
203
|
+
log("已备份: %s" % ba)
|
|
204
|
+
path, matched = build(flat=a.test_percent or None)
|
|
205
|
+
for k, n, pts in matched:
|
|
206
|
+
log("挂曲线 %-8s -> %-30s %s" % (k, n, pts))
|
|
207
|
+
log("已生成 %s" % path)
|
|
208
|
+
if not a.apply:
|
|
209
|
+
log("未应用(加 --apply 才热加载到运行中的 FanControl)")
|
|
210
|
+
return 0
|
|
211
|
+
rc = apply_cfg(path)
|
|
212
|
+
time.sleep(8)
|
|
213
|
+
status()
|
|
214
|
+
return rc
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
if __name__ == "__main__":
|
|
218
|
+
sys.exit(main())
|