dsh-qqbot-muu 0.1.15 → 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.
Files changed (171) hide show
  1. package/CHANGELOG.md +168 -85
  2. package/client/qqbot-settings.js +13401 -12024
  3. package/config/modules.json +212 -0
  4. package/dist/channel-tools.js +21 -10
  5. package/dist/config.d.ts +14 -0
  6. package/dist/config.js +573 -449
  7. package/dist/features/contextless-store.js +247 -247
  8. package/dist/features/contextless-trim.js +455 -34
  9. package/dist/features/four-source.js +338 -336
  10. package/dist/features/group-join-request.js +289 -287
  11. package/dist/features/local-models.js +1494 -0
  12. package/dist/features/rotate-summarizer.js +438 -0
  13. package/dist/features/scenario-detect.js +321 -0
  14. package/dist/features/scheduler.js +8 -1
  15. package/dist/features/session-rotate.js +499 -0
  16. package/dist/features/session-title.js +199 -0
  17. package/dist/features/style-layer.js +501 -0
  18. package/dist/features/thinking-log.js +71 -69
  19. package/dist/gateway/bootstrap.js +1704 -1388
  20. package/dist/gateway/data-root.js +77 -3
  21. package/dist/gateway/middleware-setup.js +6 -3
  22. package/dist/index.js +4 -2
  23. package/dist/model/settings-reader.js +193 -102
  24. package/dist/session/session-manager.js +1730 -1587
  25. package/dist/shared/paths.js +128 -0
  26. package/dist/shared/settings-io.js +79 -0
  27. package/dist/transport/inbound.js +20 -1
  28. package/dist/transport/outbound.js +56 -4
  29. package/docs/RELEASE_CHECKLIST.md +24 -2
  30. package/dshqqbot/.qqbot-extensions/hooks/interview-panel.mjs +41 -1
  31. package/dshqqbot/.qqbot-extensions/inbound/00-vision.mjs +111 -0
  32. package/dshqqbot/.qqbot-extensions/inbound/aa-memory-recall.mjs +802 -689
  33. package/dshqqbot/.qqbot-extensions/inbound/ac-image-see.mjs +1 -1
  34. package/dshqqbot/.qqbot-extensions/inbound/az-feedback.mjs +113 -115
  35. package/dshqqbot/.qqbot-extensions/inbound/local-answer.mjs +689 -568
  36. package/dshqqbot/.qqbot-extensions/lib/.pet-form.json +1 -1
  37. package/dshqqbot/.qqbot-extensions/lib/draw-core.mjs +238 -7
  38. package/dshqqbot/.qqbot-extensions/lib/local-llm.mjs +455 -394
  39. package/dshqqbot/.qqbot-extensions/lib/memory-agent.mjs +930 -928
  40. package/dshqqbot/.qqbot-extensions/lib/memory-core.mjs +537 -537
  41. package/dshqqbot/.qqbot-extensions/lib/memory-db.mjs +2476 -2245
  42. package/dshqqbot/.qqbot-extensions/lib/memory-hippo.mjs +18 -0
  43. package/dshqqbot/.qqbot-extensions/lib/memory.mjs +191 -186
  44. package/dshqqbot/.qqbot-extensions/lib/plugin-dir.mjs +14 -4
  45. package/dshqqbot/.qqbot-extensions/lib/scope-util.mjs +84 -0
  46. package/dshqqbot/.qqbot-extensions/lib/vision.mjs +1 -1
  47. package/dshqqbot/.qqbot-extensions/outbound/aa-sanitize.mjs +158 -154
  48. package/dshqqbot/.qqbot-extensions/outbound/ac-media-fix.mjs +5 -1
  49. package/dshqqbot/.qqbot-extensions/outbound/memory-agent.mjs +121 -130
  50. package/dshqqbot/.qqbot-extensions/outbound/split-reply.mjs +18 -2
  51. package/dshqqbot/.qqbot-extensions/outbound/turn-memory.mjs +92 -101
  52. package/dshqqbot/.qqbot-extensions/tools/draw.mjs +22 -1
  53. package/dshqqbot/.qqbot-extensions/tools/memory.mjs +178 -120
  54. package/dshqqbot/.qqbot-extensions/tools/pet_card.mjs +3 -2
  55. package/dshqqbot/.qqbot-extensions/tools/storyboard.mjs +3 -1
  56. package/dshqqbot/.qqbot-extensions/vendor/abogus/test-abogus.mjs +128 -126
  57. package/package.json +119 -111
  58. package/scripts/__pycache__/fan-mode.cpython-311.pyc +0 -0
  59. package/scripts/__pycache__/memory-audit.cpython-311.pyc +0 -0
  60. package/scripts/__pycache__/qq-ip-sync.cpython-311.pyc +0 -0
  61. package/scripts/__pycache__/qq-whitelist.cpython-311.pyc +0 -0
  62. package/scripts/_add_maintenance_cfg.py +20 -0
  63. package/scripts/_bench_keeplease.sh +10 -0
  64. package/scripts/_dbg_purge.py +15 -0
  65. package/scripts/_elev.sh +6 -0
  66. package/scripts/_fix_all_admin.cmd +16 -0
  67. package/scripts/_livecheck-image.mjs +33 -0
  68. package/scripts/_livecheck-llm.mjs +34 -0
  69. package/scripts/_livecheck-tts.mjs +37 -0
  70. package/scripts/_patch_curve.py +88 -0
  71. package/scripts/_patch_fan_thermal.py +24 -0
  72. package/scripts/_tag_tmp.py +13 -0
  73. package/scripts/adb-broker-client.mjs +87 -0
  74. package/scripts/adb-broker.mjs +205 -0
  75. package/scripts/ai-mode.cmd +6 -0
  76. package/scripts/ai-mode.py +387 -0
  77. package/scripts/ai-toolkit.py +607 -0
  78. package/scripts/apply-fan-gpu45.py +51 -0
  79. package/scripts/bench-fans.py +515 -0
  80. package/scripts/bench-load-direct.py +63 -0
  81. package/scripts/boot-tasks-hidden.vbs +20 -0
  82. package/scripts/boot-tasks.cmd +277 -0
  83. package/scripts/chat-archive/__pycache__/build-sft-v4.cpython-311.pyc +0 -0
  84. package/scripts/chat-archive/__pycache__/build-sft.cpython-311.pyc +0 -0
  85. package/scripts/chat-archive/build-sft-v4.py +566 -0
  86. package/scripts/chat-archive/build-sft.py +390 -0
  87. package/scripts/chat-archive/eval-sft.py +155 -0
  88. package/scripts/chat-archive/extract-memory.py +143 -0
  89. package/scripts/chat-archive/inventory.py +182 -0
  90. package/scripts/chat-archive/merge-sft.py +114 -0
  91. package/scripts/chat-archive/qce-pull.py +217 -0
  92. package/scripts/chat-archive/qqheader.py +110 -0
  93. package/scripts/chat-archive/qqkey2.py +113 -0
  94. package/scripts/chat-archive/qqprobe.py +153 -0
  95. package/scripts/chat-archive/screen-collect.py +163 -0
  96. package/scripts/chat-archive/sqlcipher_probe.py +444 -0
  97. package/scripts/comfy_gen.py +209 -0
  98. package/scripts/compose-video.py +168 -0
  99. package/scripts/dl_models.py +45 -0
  100. package/scripts/draw-now.cmd +18 -0
  101. package/scripts/dsh-instance-guard.mjs +20 -2
  102. package/scripts/elev-extra.cmd +25 -0
  103. package/scripts/episode.py +529 -0
  104. package/scripts/fan-curve.py +218 -0
  105. package/scripts/fan-guard.cmd +8 -0
  106. package/scripts/fan-mode.py +380 -0
  107. package/scripts/fan_manual_safe.py +33 -0
  108. package/scripts/fan_restore_manual.py +46 -0
  109. package/scripts/fc_curves.py +359 -0
  110. package/scripts/fix-fan-and-timers.cmd +39 -0
  111. package/scripts/fix_admin_all.py +94 -0
  112. package/scripts/flows.mjs +224 -0
  113. package/scripts/gateway.cmd +126 -0
  114. package/scripts/gen-image.py +420 -0
  115. package/scripts/gen-video.py +186 -0
  116. package/scripts/git-askpass.cmd +2 -2
  117. package/scripts/gpu-mode.py +195 -0
  118. package/scripts/hw-profile.py +175 -0
  119. package/scripts/install-schedule.cmd +37 -0
  120. package/scripts/install-watch.cmd +29 -0
  121. package/scripts/matte-cutout.py +106 -0
  122. package/scripts/media-enhance.py +402 -0
  123. package/scripts/memory-audit.py +581 -0
  124. package/scripts/migrate-scope.mjs +140 -139
  125. package/scripts/model-registry.py +519 -0
  126. package/scripts/openid-audit.mjs +219 -0
  127. package/scripts/pull-gguf.py +127 -0
  128. package/scripts/purge-standby.py +151 -0
  129. package/scripts/qq-connect-login.py +133 -0
  130. package/scripts/qq-ip-sync-hidden.vbs +5 -0
  131. package/scripts/qq-ip-sync.py +300 -0
  132. package/scripts/qq-login-once.cmd +20 -0
  133. package/scripts/qq-login-qr.py +72 -0
  134. package/scripts/qq-whitelist-fix.cmd +27 -0
  135. package/scripts/qq-whitelist-login.cmd +26 -0
  136. package/scripts/qq-whitelist.cmd +12 -0
  137. package/scripts/qq-whitelist.py +1452 -0
  138. package/scripts/quality-compare.py +134 -0
  139. package/scripts/release-all.mjs +636 -430
  140. package/scripts/release-check.mjs +244 -226
  141. package/scripts/resume-coder.cmd +38 -0
  142. package/scripts/secure-room/index.html +334 -0
  143. package/scripts/secure-room/server.py +582 -0
  144. package/scripts/security-check.mjs +164 -0
  145. package/scripts/selftest-local-llm.mjs +20 -0
  146. package/scripts/selftest-local-models.mjs +754 -0
  147. package/scripts/selftest-rotate-style.mjs +308 -0
  148. package/scripts/shutdown-s5-optional.cmd +21 -0
  149. package/scripts/sleep-2325.cmd +75 -0
  150. package/scripts/start-comfyui.cmd +5 -0
  151. package/scripts/start-strata.cmd +17 -0
  152. package/scripts/start-strata.vbs +11 -0
  153. package/scripts/start-watch-hidden.vbs +3 -0
  154. package/scripts/stickers/auto-tag.mjs +161 -0
  155. package/scripts/storage.mjs +236 -0
  156. package/scripts/sync-plugin-copies.mjs +98 -23
  157. package/scripts/tests/test-qq-whitelist.py +192 -0
  158. package/scripts/train/__pycache__/train-lora.cpython-311.pyc +0 -0
  159. package/scripts/train/gguf-quantize.py +92 -0
  160. package/scripts/train/gguf-to-hf.py +112 -0
  161. package/scripts/train/merge-lora.py +51 -0
  162. package/scripts/train/probe-mirrors.sh +12 -0
  163. package/scripts/train/probe-mirrors2.sh +20 -0
  164. package/scripts/train/setup-wsl.sh +23 -0
  165. package/scripts/train/setup-wsl2.sh +25 -0
  166. package/scripts/train/setup-wsl3.sh +22 -0
  167. package/scripts/train/setup-wsl4.sh +22 -0
  168. package/scripts/train/train-lora.py +319 -0
  169. package/scripts/vram-free.py +104 -0
  170. package/scripts/wechat-full-pull.mjs +1 -1
  171. package/settings-host.js +1047 -12
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * security-check.mjs —— 仓库级安全 / 隐私审计(2026-11-30 规范化进发布流程)
4
+ *
5
+ * 定位:
6
+ * - `release-check.mjs` 管「npm 包里有没有泄漏」;
7
+ * - `check-pack-privacy.mjs` 管「打包内容」;
8
+ * - 这里补上「仓库本身」:凭证文件有没有被 git 跟踪、关键忽略项在不在、
9
+ * 有没有把路径拼进 shell、面板路由有没有绕过同源闸门、临时目录是否全部登记。
10
+ *
11
+ * 用法:
12
+ * node scripts/security-check.mjs # 人读摘要
13
+ * node scripts/security-check.mjs --json # 机器读
14
+ * 输出:out/reports/security-<日期>.json(可直接归档/对比)
15
+ * 退出码:有 hard 失败 → 1;只有 warn → 0(但会列出来)
16
+ */
17
+ import { existsSync, readFileSync, readdirSync, statSync, mkdirSync, writeFileSync } from 'node:fs'
18
+ import { execFileSync } from 'node:child_process'
19
+ import { dirname, join, relative } from 'node:path'
20
+ import { tmpdir } from 'node:os'
21
+ import { fileURLToPath } from 'node:url'
22
+
23
+ const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..')
24
+ const JSON_OUT = process.argv.includes('--json')
25
+ const rows = []
26
+ const add = (level, id, title, detail) => rows.push({ level, id, title, detail: detail || '' })
27
+
28
+ const SKIP_DIRS = new Set(['.git', '.models', 'node_modules', '.pnpm-store', 'out', 'logs', 'secrets', 'archive', '.trae', '.workbuddy', '.venv-draw', '.upload', '.uploads', 'dist-cache', '.tools', 'tmp'])
29
+ // 允许清单:本机网关 key 文件、文档里的示例、测试夹具、以及"拼出来"的令牌不当作泄漏
30
+ const ALLOW_FILES = [/^services\/gateway\/clients\.json$/, /^docs\//, /\.md$/, /-test\.mjs$/, /^scripts\/(release-all|check-secrets|archive-secrets)\.mjs$/, /^qqbot-mod\/scripts\/(privacy|bili-ops)-test\.mjs$/]
31
+ const TEXT_EXT = /\.(mjs|js|cjs|ts|json|md|yml|yaml|py|ps1|sh|txt|example|toml)$/i
32
+
33
+ function walk(dir, depth = 0, out = []) {
34
+ if (depth > 6) return out
35
+ let ents = []
36
+ try { ents = readdirSync(dir, { withFileTypes: true }) } catch { return out }
37
+ for (const e of ents) {
38
+ if (e.isDirectory()) {
39
+ if (SKIP_DIRS.has(e.name)) continue
40
+ walk(join(dir, e.name), depth + 1, out)
41
+ } else if (e.isFile()) out.push(join(dir, e.name))
42
+ }
43
+ return out
44
+ }
45
+
46
+ // 1) 明文凭证扫描(只扫文本,密钥格式 + 常见字段赋值)
47
+ const SECRET_PATTERNS = [
48
+ { re: /\bsk-[A-Za-z0-9_-]{12,}/, name: '疑似 API Key (sk-)' },
49
+ { re: /\bghp_[A-Za-z0-9]{20,}/, name: 'GitHub token (ghp_)' },
50
+ { re: /\bxox[baprs]-[A-Za-z0-9-]{10,}/, name: 'Slack token' },
51
+ { re: /-----BEGIN (RSA |EC )?PRIVATE KEY-----/, name: '私钥' },
52
+ { re: /\b(api[_-]?key|secret|password|token)\s*[:=]\s*['"]([^'"]{16,})['"]/i, name: '硬编码凭证字段', allowConcat: true },
53
+ ]
54
+ const hits = []
55
+ for (const f of walk(ROOT)) {
56
+ if (!TEXT_EXT.test(f)) continue
57
+ const rel = relative(ROOT, f).split('\\').join('/')
58
+ if (ALLOW_FILES.some((re) => re.test(rel))) continue
59
+ if (/\.(example|sample)\./i.test(f)) continue
60
+ let txt = ''
61
+ try { const st = statSync(f); if (st.size > 2 * 1024 * 1024) continue; txt = readFileSync(f, 'utf8') } catch { continue }
62
+ for (const p of SECRET_PATTERNS) {
63
+ const m = txt.match(p.re)
64
+ if (!m) continue
65
+ // "拼出来"的值('xxx' + var)不是泄漏
66
+ if (p.allowConcat && /\+\s*[A-Za-z_$]/.test(String(m[2] || m[0]))) continue
67
+ const line = txt.slice(0, m.index).split(/\r?\n/).length
68
+ hits.push({ file: rel, line, kind: p.name })
69
+ }
70
+ }
71
+ add(hits.length ? 'hard' : 'ok', 'secrets', '源码里没有明文凭证',
72
+ hits.length ? hits.slice(0, 8).map((h) => `${h.file}:${h.line} ${h.kind}`).join('\n') : '扫描 ' + walk(ROOT).filter((f) => TEXT_EXT.test(f)).length + ' 个文本文件')
73
+
74
+ // 2) git 跟踪的凭证类文件必须为 0
75
+ let tracked = ''
76
+ try { tracked = execFileSync('git', ['ls-files'], { cwd: ROOT, encoding: 'utf8', windowsHide: true }) } catch { tracked = '' }
77
+ const suspicious = tracked.split(/\r?\n/).filter(Boolean)
78
+ // 只看"数据/凭证"类文件;名字里带 token/secret 的脚本不是凭证
79
+ .filter((f) => /(cookie|credential|\.pem$|\.key$|id_rsa)/i.test(f) || /(^|\/)(token|secret)s?\.(json|txt|env)$/i.test(f))
80
+ .filter((f) => !/(example|sample|\.md$)/i.test(f))
81
+ add(suspicious.length ? 'hard' : 'ok', 'git-cred', 'git 没有跟踪凭证文件',
82
+ suspicious.length ? suspicious.slice(0, 10).join('\n') : '已检查 ' + tracked.split(/\r?\n/).filter(Boolean).length + ' 个跟踪文件')
83
+
84
+ // 3) .gitignore 关键项
85
+ let gi = ''
86
+ try { gi = readFileSync(join(ROOT, '.gitignore'), 'utf8') } catch { /* 没有就是问题 */ }
87
+ const need = ['/secrets/', '/douyin-cookie.json', '/gate.json', '/tmp/', '/.cache/', '/logs/', '/.screenshots/']
88
+ // 白名单式 .gitignore(第一行有效内容就是 *)已经默认忽略一切,不再逐项要求
89
+ const blanket = gi.split(/\r?\n/).map((l) => l.trim()).filter(Boolean).slice(0, 2).includes('*')
90
+ const missing = blanket ? [] : need.filter((x) => !gi.split(/\r?\n/).some((l) => l.trim() === x))
91
+ add(missing.length ? 'hard' : 'ok', 'gitignore', '.gitignore 覆盖了凭证与临时目录',
92
+ missing.length ? '缺少:' + missing.join(' , ') : (blanket ? '白名单式忽略(* + !)已覆盖全部本地文件' : need.join(' ')))
93
+
94
+ // 4) 不把路径拼进 shell(命令注入面)
95
+ const shellHits = []
96
+ for (const rel of ['settings-host.js', 'entry.js', 'index.js']) {
97
+ const p = join(ROOT, rel)
98
+ if (!existsSync(p)) continue
99
+ const txt = readFileSync(p, 'utf8')
100
+ const lines = txt.split(/\r?\n/)
101
+ lines.forEach((l, i) => {
102
+ if (/(spawn|exec|execSync|execFileSync)\(/.test(l) && /shell:\s*true/.test(l)) shellHits.push(`${rel}:${i + 1} shell:true`)
103
+ if (/-Command/.test(l) && /\+/.test(l)) shellHits.push(`${rel}:${i + 1} -Command 拼字符串`)
104
+ })
105
+ }
106
+ add(shellHits.length ? 'hard' : 'ok', 'shell', '没有把变量拼进 shell 命令', shellHits.join('\n') || '扫描 settings-host.js / entry.js / index.js')
107
+
108
+ // 5) 面板里的 raw http handler 是否都走了 route()(同源闸门)
109
+ let raw = 0
110
+ const sh = join(ROOT, 'settings-host.js')
111
+ if (existsSync(sh)) {
112
+ const txt = readFileSync(sh, 'utf8')
113
+ raw = (txt.match(/webServer\.(get|post|put|delete|all)\s*\(/g) || []).length
114
+ }
115
+ add(raw > 0 ? 'warn' : 'ok', 'fence', '面板路由统一走 route() 同源闸门',
116
+ raw > 0 ? `发现 ${raw} 处直接挂 webServer.*(可能绕过 refuseUntrusted,请改用 route())` : '没有绕过 route() 的裸 handler')
117
+
118
+ // 6) 临时目录必须登记进 config/storage.json
119
+ let areas = []
120
+ try { areas = JSON.parse(readFileSync(join(ROOT, 'config', 'storage.json'), 'utf8')).areas || [] } catch { /* ignore */ }
121
+ const osPats = areas.flatMap((a) => a.osTemp || [])
122
+ const declared = osPats.map((p) => String(p).replace(/\*+$/, ''))
123
+ const codeFiles = walk(ROOT).filter((f) => /\.(mjs|js|py)$/.test(f))
124
+ const undeclared = new Set()
125
+ for (const f of codeFiles) {
126
+ let t = ''
127
+ try { if (statSync(f).size > 1024 * 1024) continue; t = readFileSync(f, 'utf8') } catch { continue }
128
+ const ms = t.match(/tmpdir\(\)[^\n]{0,40}?['"`]([A-Za-z0-9_-]+)-/g) || []
129
+ for (const m of ms) {
130
+ const pre = m.replace(/.*['"`]/, '').replace(/-$/, '')
131
+ if (pre && !declared.some((d) => d && (pre.startsWith(d) || d.startsWith(pre) || pre.includes(d)))) undeclared.add(pre + '-*')
132
+ }
133
+ }
134
+ add(undeclared.size ? 'warn' : 'ok', 'tmp-decl', '系统临时文件都有登记(config/storage.json)',
135
+ undeclared.size ? '未登记前缀:' + Array.from(undeclared).join(' , ') + '(加进 storage.json 的 osTemp)' : '已登记:' + osPats.join(' '))
136
+
137
+ // 7) 高危目录是不是忽略/只本地
138
+ const dirs = ['.qqbot', '.models', 'vision-cache', '.screenshots', 'tmp']
139
+ const badDirs = dirs.filter((d) => existsSync(join(ROOT, d)) && !gi.includes('/' + d + '/') && !gi.includes('/' + d) && tracked.includes(d))
140
+ add(badDirs.length ? 'warn' : 'ok', 'dirs', '本地产物目录没有进 git', badDirs.join(' , ') || dirs.join(' '))
141
+
142
+ // ── 输出 ────────────────────────────────────────────────────────────────
143
+ const hard = rows.filter((r) => r.level === 'hard')
144
+ const warn = rows.filter((r) => r.level === 'warn')
145
+ const report = { at: new Date().toISOString(), root: ROOT, hard: hard.length, warn: warn.length, rows }
146
+ try {
147
+ const dir = join(ROOT, 'out', 'reports')
148
+ mkdirSync(dir, { recursive: true })
149
+ writeFileSync(join(dir, 'security-' + new Date().toISOString().slice(0, 10) + '.json'), JSON.stringify(report, null, 1), 'utf8')
150
+ } catch { /* 报告写不了不影响结论 */ }
151
+
152
+ if (JSON_OUT) {
153
+ console.log(JSON.stringify(report, null, 2))
154
+ } else {
155
+ console.log('\n=== qqbot 安全 / 隐私审计 ===\n')
156
+ const icon = { ok: '✓', warn: '⚠', hard: '✗' }
157
+ for (const r of rows) {
158
+ console.log(`${icon[r.level]} ${r.title}`)
159
+ if (r.detail && r.level !== 'ok') console.log(r.detail.split('\n').map((l) => ' ' + l).join('\n'))
160
+ }
161
+ console.log(`\n${rows.length - hard.length - warn.length} 通过 / ${warn.length} 提醒 / ${hard.length} 必须修`)
162
+ console.log('报告:out/reports/security-' + new Date().toISOString().slice(0, 10) + '.json\n')
163
+ }
164
+ process.exitCode = hard.length ? 1 : 0
@@ -0,0 +1,20 @@
1
+ // selftest-local-llm.mjs —— 验证 lib/local-llm.mjs 两套协议都能跑
2
+ // 用法: node F:\qqbot\scripts\selftest-local-llm.mjs [openaiBaseUrl] [model]
3
+ import { health, chat, useOpenAI } from '../dshqqbot/.qqbot-extensions/lib/local-llm.mjs'
4
+
5
+ const oaBase = process.argv[2] || ''
6
+ const oaModel = process.argv[3] || ''
7
+
8
+ const ollamaCfg = { provider: 'ollama', baseUrl: 'http://127.0.0.1:11434', model: 'qwen2.5:1.5b', timeoutMs: 20000, maxTokens: 24 }
9
+ console.log('[ollama] useOpenAI =', useOpenAI(ollamaCfg))
10
+ console.log('[ollama] health =', JSON.stringify(await health(ollamaCfg, true)))
11
+ const r1 = await chat({ cfg: ollamaCfg, messages: [{ role: 'user', content: '用三个字打个招呼' }] })
12
+ console.log('[ollama] chat =', JSON.stringify(r1))
13
+
14
+ if (oaBase) {
15
+ const oaCfg = { provider: 'openai', baseUrl: oaBase, model: oaModel, timeoutMs: 120000, maxTokens: 24 }
16
+ console.log('[openai] useOpenAI =', useOpenAI(oaCfg))
17
+ console.log('[openai] health =', JSON.stringify(await health(oaCfg, true)))
18
+ const r2 = await chat({ cfg: oaCfg, messages: [{ role: 'user', content: '用三个字打个招呼' }] })
19
+ console.log('[openai] chat =', JSON.stringify(r2))
20
+ }