@zaofan/dsh-qqbot 1.11.32 → 1.11.34

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.
@@ -12,8 +12,8 @@ window.__ModuleLoader__.load({
12
12
  var useState = React.useState
13
13
  var useEffect = React.useEffect
14
14
 
15
- var READ = '/api/qqbot-settings/read'
16
- var UPDATE = '/api/qqbot-settings/update'
15
+ var READ = 'api/qqbot-settings/read'
16
+ var UPDATE = 'api/qqbot-settings/update'
17
17
 
18
18
  var labelStyle = { display: 'block', margin: '6px 0', fontSize: 13 }
19
19
  var inputStyle = { marginLeft: 8, padding: '2px 6px', border: '1px solid #8884', borderRadius: 4, background: 'transparent', color: 'inherit', width: 110 }
@@ -671,7 +671,7 @@ window.__ModuleLoader__.load({
671
671
  }
672
672
  function extUiLoad(extId, f, slot) {
673
673
  // slot 用于区分「同一个扩展 id 在 profile 级 / 数据根各有一张卡」的情况(见 ext-ui.ts 注释)
674
- var u = '/api/qqbot-settings/ext-ui/file?f=' + encodeURIComponent(f) + '&id=' + encodeURIComponent(extId)
674
+ var u = 'api/qqbot-settings/ext-ui/file?f=' + encodeURIComponent(f) + '&id=' + encodeURIComponent(extId)
675
675
  if (slot) u += '&slot=' + encodeURIComponent(slot)
676
676
  return fetch(u)
677
677
  .then(function (r) { return r.json() })
@@ -726,7 +726,7 @@ window.__ModuleLoader__.load({
726
726
  getConfig: function (s, acctOverride) {
727
727
  var sc = s === 'profile' || s === 'data' ? s : scope
728
728
  var a = acctOverride || acctCtx
729
- var u = '/api/qqbot-settings/ext-config?id=' + encodeURIComponent(extId) + '&scope=' + sc
729
+ var u = 'api/qqbot-settings/ext-config?id=' + encodeURIComponent(extId) + '&scope=' + sc
730
730
  var cw = acctCwdOf(a)
731
731
  if (sc === 'data' && cw) u += '&cwd=' + encodeURIComponent(cw)
732
732
  return fetch(u)
@@ -738,7 +738,7 @@ window.__ModuleLoader__.load({
738
738
  var sc = s === 'profile' || s === 'data' ? s : scope
739
739
  var a = acctOverride || acctCtx
740
740
  var cw = acctCwdOf(a)
741
- return fetch('/api/qqbot-settings/ext-config', {
741
+ return fetch('api/qqbot-settings/ext-config', {
742
742
  method: 'POST',
743
743
  headers: { 'Content-Type': 'application/json' },
744
744
  body: JSON.stringify({ id: extId, scope: sc, patch: patch || {}, cwd: sc === 'data' ? cw : '' }),
@@ -750,7 +750,7 @@ window.__ModuleLoader__.load({
750
750
  // ★ 2026-10-27:dock 卡片额外带 dataRoot —— hooks 是「插件启动时跑一次」,
751
751
  // 其 env.dataRoot 是**插件级**的(主实例那份),不是当前机器人实例的。
752
752
  // 所以数据根必须随请求传,让 handler 用 query.dataRoot 自己算路径。
753
- var u = '/api/ext/dispatch?id=' + encodeURIComponent(extId) + '&p=' + encodeURIComponent(String(p || '/'))
753
+ var u = 'api/ext/dispatch?id=' + encodeURIComponent(extId) + '&p=' + encodeURIComponent(String(p || '/'))
754
754
  if (dockCtx && dockCtx.dataRoot) u += '&dataRoot=' + encodeURIComponent(dockCtx.dataRoot)
755
755
  return fetch(u, Object.assign({ headers: { 'Content-Type': 'application/json' } }, opts || {}))
756
756
  .then(function (r) { return r.json() })
@@ -798,7 +798,7 @@ window.__ModuleLoader__.load({
798
798
  */
799
799
  cap: function (fn) {
800
800
  var args = Array.prototype.slice.call(arguments, 1);
801
- var u = '/api/ext/dispatch?id=' + encodeURIComponent(extId)
801
+ var u = 'api/ext/dispatch?id=' + encodeURIComponent(extId)
802
802
  + '&p=' + encodeURIComponent('/__cap')
803
803
  + '&fn=' + encodeURIComponent(String(fn || ''))
804
804
  + '&args=' + encodeURIComponent(JSON.stringify(args))
@@ -850,7 +850,7 @@ window.__ModuleLoader__.load({
850
850
  var q = function (what) {
851
851
  // ★ 2026-10-27:必须带上 dataRoot / cwd —— 否则后端推不出当前实例的数据根,
852
852
  // 会落到宿主默认(表现为"切到 3 号机读到的还是 2 号机的路径")。
853
- var u = '/api/qqbot-settings/dock-data?what=' + encodeURIComponent(what)
853
+ var u = 'api/qqbot-settings/dock-data?what=' + encodeURIComponent(what)
854
854
  if (dockCtx.ns) u += '&ns=' + encodeURIComponent(dockCtx.ns)
855
855
  if (dockCtx.dataRoot) u += '&dataRoot=' + encodeURIComponent(dockCtx.dataRoot)
856
856
  if (dockCtx.cwd) u += '&cwd=' + encodeURIComponent(dockCtx.cwd)
@@ -991,7 +991,7 @@ window.__ModuleLoader__.load({
991
991
  if (_dockTabsLoaded && !force && root === _dockTabsRoot) return
992
992
  _dockTabsLoaded = true
993
993
  _dockTabsRoot = root
994
- var u = '/api/qqbot-settings/ext-ui/list'
994
+ var u = 'api/qqbot-settings/ext-ui/list'
995
995
  if (root) u += '?dataRoot=' + encodeURIComponent(root)
996
996
  fetch(u)
997
997
  .then(function (r) { return r.json() })
@@ -1062,7 +1062,7 @@ window.__ModuleLoader__.load({
1062
1062
  cwd: (ac && ac.cwd) || '',
1063
1063
  peer: peer,
1064
1064
  }
1065
- var u = '/api/qqbot-settings/dock-data?what=context'
1065
+ var u = 'api/qqbot-settings/dock-data?what=context'
1066
1066
  if (base.ns) u += '&ns=' + encodeURIComponent(base.ns)
1067
1067
  if (base.dataRoot) u += '&dataRoot=' + encodeURIComponent(base.dataRoot)
1068
1068
  if (base.cwd) u += '&cwd=' + encodeURIComponent(base.cwd)
@@ -1223,15 +1223,15 @@ window.__ModuleLoader__.load({
1223
1223
  // 用 Shadow DOM 的两个理由:
1224
1224
  // ① 扩展写的 CSS 不会污染这个 535KB 单文件里的任何样式(一条全局 button{} 就能改全站)
1225
1225
  // ② 扩展脚本报错只白自己那张卡,不整页崩
1226
- var EXT_UI_LIST = '/api/qqbot-settings/ext-ui/list'
1227
- var EXT_UI_FILE = '/api/qqbot-settings/ext-ui/file?f='
1226
+ var EXT_UI_LIST = 'api/qqbot-settings/ext-ui/list'
1227
+ var EXT_UI_FILE = 'api/qqbot-settings/ext-ui/file?f='
1228
1228
  // ★ 2026-10-27 删:extUiText 只被 mountExtUiCards 用过(已删),成死代码。
1229
1229
  function extUiApi(extId) {
1230
1230
  return {
1231
1231
  extId: extId,
1232
1232
  // 扩展自己的只读/只写接口走 /api/ext/<id>/…(由扩展自己注册,本插件不代管)
1233
1233
  api: function (p, opts) {
1234
- return fetch('/api/ext/' + encodeURIComponent(extId) + String(p || ''),
1234
+ return fetch('api/ext/' + encodeURIComponent(extId) + String(p || ''),
1235
1235
  Object.assign({ headers: { 'Content-Type': 'application/json' } }, opts || {}))
1236
1236
  .then(function (r) { return r.json() })
1237
1237
  .catch(function () { return null })
@@ -1307,13 +1307,13 @@ window.__ModuleLoader__.load({
1307
1307
 
1308
1308
  function loadMembers() {
1309
1309
  if (!gid) return
1310
- fetch('/api/qqbot-settings/group/members_local' + nsq + (nsq ? '&' : '?') + 'gid=' + encodeURIComponent(gid)).then(function (r) { return r.json() }).then(function (d) {
1310
+ fetch('api/qqbot-settings/group/members_local' + nsq + (nsq ? '&' : '?') + 'gid=' + encodeURIComponent(gid)).then(function (r) { return r.json() }).then(function (d) {
1311
1311
  setMembers(d && d.ok ? (d.members || []) : [])
1312
1312
  }).catch(function () { setMembers([]) })
1313
1313
  }
1314
1314
 
1315
1315
  function loadAccounts() {
1316
- fetch('/api/qqbot-settings/group/accounts' + nsq).then(function (r) { return r.json() }).then(function (d) {
1316
+ fetch('api/qqbot-settings/group/accounts' + nsq).then(function (r) { return r.json() }).then(function (d) {
1317
1317
  if (d && d.error) { setMsg('群面板: ' + d.error); setAccts([]); return }
1318
1318
  var list = (d && Array.isArray(d.groups) ? d.groups : []).map(function (g) { return { gid: g.gid, name: g.name || '', from: g.from || '' } })
1319
1319
  setAccts(list)
@@ -1324,11 +1324,11 @@ window.__ModuleLoader__.load({
1324
1324
  function refresh() {
1325
1325
  if (!gid) return
1326
1326
  if (tab === 'join') {
1327
- fetch('/api/qqbot-settings/group/join_requests' + nsq + (nsq ? '&' : '?') + 'gid=' + encodeURIComponent(gid)).then(function (r) { return r.json() }).then(function (d) {
1327
+ fetch('api/qqbot-settings/group/join_requests' + nsq + (nsq ? '&' : '?') + 'gid=' + encodeURIComponent(gid)).then(function (r) { return r.json() }).then(function (d) {
1328
1328
  if (d && d.ok) setJoins(d); else setMsg((d && d.err && d.err.human) || '申请列表加载失败')
1329
1329
  }).catch(function (e) { setMsg('申请列表加载异常: ' + e.message) })
1330
1330
  } else if (tab === 'mute') {
1331
- fetch('/api/qqbot-settings/group/mute_state' + nsq + (nsq ? '&' : '?') + 'gid=' + encodeURIComponent(gid)).then(function (r) { return r.json() }).then(function (d) {
1331
+ fetch('api/qqbot-settings/group/mute_state' + nsq + (nsq ? '&' : '?') + 'gid=' + encodeURIComponent(gid)).then(function (r) { return r.json() }).then(function (d) {
1332
1332
  if (d && d.ok) setMute(d); else setMsg((d && d.err && d.err.human) || '禁言状态加载失败')
1333
1333
  }).catch(function (e) { setMsg('禁言状态加载异常: ' + e.message) })
1334
1334
  }
@@ -1340,7 +1340,7 @@ window.__ModuleLoader__.load({
1340
1340
  var reason = op === 'decline' ? window.prompt('拒绝理由(可留空)') : '-'
1341
1341
  if (op === 'decline' && reason === null) return
1342
1342
  setBusy('approve-' + mid)
1343
- fetch('/api/qqbot-settings/group/approve', {
1343
+ fetch('api/qqbot-settings/group/approve', {
1344
1344
  method: 'POST', headers: { 'content-type': 'application/json' },
1345
1345
  body: JSON.stringify(Object.assign({ gid: gid, member_openid: mid, op: op, reason: reason || '' }, props.ns ? { ns: props.ns } : {})),
1346
1346
  }).then(function (r) { return r.json() }).then(function (d) {
@@ -1352,7 +1352,7 @@ window.__ModuleLoader__.load({
1352
1352
  function doMute(mid, action, seconds) {
1353
1353
  var secs = action === 'mute' ? Math.round(Number(seconds || 600)) : 0
1354
1354
  setBusy('mute-' + mid)
1355
- fetch('/api/qqbot-settings/group/mute', {
1355
+ fetch('api/qqbot-settings/group/mute', {
1356
1356
  method: 'POST', headers: { 'content-type': 'application/json' },
1357
1357
  body: JSON.stringify(Object.assign({ gid: gid, member_openid: mid, action: action, seconds: secs }, props.ns ? { ns: props.ns } : {})),
1358
1358
  }).then(function (r) { return r.json() }).then(function (d) {
@@ -1364,7 +1364,7 @@ window.__ModuleLoader__.load({
1364
1364
  function doBind() {
1365
1365
  var g = bindGid.trim()
1366
1366
  if (!g) { setMsg('先粘贴 group_openid'); return }
1367
- fetch('/api/qqbot-settings/group/bind', {
1367
+ fetch('api/qqbot-settings/group/bind', {
1368
1368
  method: 'POST', headers: { 'content-type': 'application/json' },
1369
1369
  body: JSON.stringify(Object.assign({ gid: g, name: bindName.trim() }, props.ns ? { ns: props.ns } : {})),
1370
1370
  }).then(function (r) { return r.json() }).then(function (d) {
@@ -1376,7 +1376,7 @@ window.__ModuleLoader__.load({
1376
1376
  var t = sendText.trim()
1377
1377
  if (!t) { setMsg('先输入要发送的内容'); return }
1378
1378
  setBusy('send')
1379
- fetch('/api/qqbot-settings/group/send', {
1379
+ fetch('api/qqbot-settings/group/send', {
1380
1380
  method: 'POST', headers: { 'content-type': 'application/json' },
1381
1381
  body: JSON.stringify(Object.assign({ gid: gid, text: t }, props.ns ? { ns: props.ns } : {})),
1382
1382
  }).then(function (r) { return r.json() }).then(function (d) {
@@ -1506,10 +1506,10 @@ window.__ModuleLoader__.load({
1506
1506
  msg ? h('span', { style: { fontSize: T.fsSm, color: T.success } }, msg) : null))
1507
1507
  }
1508
1508
 
1509
- var API_LIST = '/api/qqbot-settings/stickers'
1510
- var API_IMG = '/api/qqbot-settings/sticker-img?id='
1511
- var API_BATCH = '/api/qqbot-settings/stickers/batch'
1512
- var API_IMPORT = '/api/qqbot-settings/stickers/import'
1509
+ var API_LIST = 'api/qqbot-settings/stickers'
1510
+ var API_IMG = 'api/qqbot-settings/sticker-img?id='
1511
+ var API_BATCH = 'api/qqbot-settings/stickers/batch'
1512
+ var API_IMPORT = 'api/qqbot-settings/stickers/import'
1513
1513
  var LAYER_LABEL = { candidate: '待整理', library: '收藏', trash: '回收站' }
1514
1514
 
1515
1515
  function Lightbox(props) {
@@ -1712,7 +1712,7 @@ window.__ModuleLoader__.load({
1712
1712
  }
1713
1713
 
1714
1714
  // ── 定时任务页(管理 AI 在 QQ 会话里建的定时任务: 一次性/每天) ──
1715
- var API_TIMERS = '/api/qqbot-settings/timers'
1715
+ var API_TIMERS = 'api/qqbot-settings/timers'
1716
1716
  function fmtWhen(job) {
1717
1717
  if (job.kind === 'daily') return '每天 ' + (job.atTime || '??:??')
1718
1718
  if (job.kind === 'once' && job.dueAt) {
@@ -1733,9 +1733,9 @@ window.__ModuleLoader__.load({
1733
1733
  var qDD = dd ? '?dataDir=' + encodeURIComponent(dd) : ''
1734
1734
  var qM = ns ? ('?ns=' + encodeURIComponent(ns)) : '' // members_local 不带 gid = 全部成员
1735
1735
  return Promise.all([
1736
- fetch('/api/qqbot-settings/group/accounts' + qNs).then(function (r) { return r.json() }).catch(function () { return {} }),
1737
- fetch('/api/qqbot-settings/known-chats' + qDD).then(function (r) { return r.json() }).catch(function () { return {} }),
1738
- fetch('/api/qqbot-settings/group/members_local' + qM).then(function (r) { return r.json() }).catch(function () { return {} }),
1736
+ fetch('api/qqbot-settings/group/accounts' + qNs).then(function (r) { return r.json() }).catch(function () { return {} }),
1737
+ fetch('api/qqbot-settings/known-chats' + qDD).then(function (r) { return r.json() }).catch(function () { return {} }),
1738
+ fetch('api/qqbot-settings/group/members_local' + qM).then(function (r) { return r.json() }).catch(function () { return {} }),
1739
1739
  ]).then(function (rs) {
1740
1740
  var groups = ((rs[0] && rs[0].groups) || []).map(function (g) {
1741
1741
  return { scope: 'group', id: g.gid, name: g.name || '', lastSeen: g.lastAt || 0, count: 0 }
@@ -2065,7 +2065,7 @@ window.__ModuleLoader__.load({
2065
2065
  var saved = ''
2066
2066
  try { saved = localStorage.getItem(TAB_KEY) || '' } catch (e) {}
2067
2067
  setTab(saved === 'gallery' || saved === 'timers' || saved === 'accounts' ? saved : 'settings')
2068
- fetch('/api/qqbot-settings/accounts').then(function (r) { return r.json() }).then(function (d) {
2068
+ fetch('api/qqbot-settings/accounts').then(function (r) { return r.json() }).then(function (d) {
2069
2069
  if (d && Array.isArray(d.instances)) {
2070
2070
  setAccts(d.instances)
2071
2071
  var want = ''
@@ -2083,7 +2083,7 @@ window.__ModuleLoader__.load({
2083
2083
  var ddq = ac && ac.dataDir ? '&dataDir=' + encodeURIComponent(ac.dataDir) : ''
2084
2084
  var sdq = ac && ac.schedDir ? '?schedDir=' + encodeURIComponent(ac.schedDir) : ''
2085
2085
  Promise.all([
2086
- fetch('/api/qqbot-settings/stickers?untagged=1&layer=candidate' + ddq).then(function (r) { return r.json() }).catch(function () { return {} }),
2086
+ fetch('api/qqbot-settings/stickers?untagged=1&layer=candidate' + ddq).then(function (r) { return r.json() }).catch(function () { return {} }),
2087
2087
  fetch(API_TIMERS + sdq).then(function (r) { return r.json() }).catch(function () { return {} }),
2088
2088
  ]).then(function (rs) {
2089
2089
  if (!alive) return
@@ -2100,7 +2100,7 @@ window.__ModuleLoader__.load({
2100
2100
  var [extTabs, setExtTabs] = useState([])
2101
2101
  useEffect(function () {
2102
2102
  var alive = true
2103
- fetch('/api/qqbot-settings/ext-ui/list')
2103
+ fetch('api/qqbot-settings/ext-ui/list')
2104
2104
  .then(function (r) { return r.json() })
2105
2105
  .then(function (j) {
2106
2106
  if (!alive || !j || !j.ok) return
@@ -2229,10 +2229,10 @@ window.__ModuleLoader__.load({
2229
2229
  }
2230
2230
 
2231
2231
  // ── 账号与预设(第4 tab): 多机器人账号(appId/secret/预设/cwd) + agent 预设复制管理 ──
2232
- var API_ACCOUNTS = '/api/qqbot-settings/accounts'
2233
- var API_PRESETS = '/api/qqbot-settings/presets'
2234
- var API_BIND = '/api/qqbot-settings/bind'
2235
- var API_WORKSPACES = '/api/qqbot-settings/workspaces'
2232
+ var API_ACCOUNTS = 'api/qqbot-settings/accounts'
2233
+ var API_PRESETS = 'api/qqbot-settings/presets'
2234
+ var API_BIND = 'api/qqbot-settings/bind'
2235
+ var API_WORKSPACES = 'api/qqbot-settings/workspaces'
2236
2236
  // appSecret 掩码(借鉴 dsh-qqbot-panel): host 只回显掩码, 留空/掩码保存=保留原值
2237
2237
  var SECRET_MASK = '********'
2238
2238
  var PRESET_HINT = '想改人设:点预设卡片「打开文件夹」,编辑里面 agent.cordis.yml —— persona 插件 config.text 那段就是人设正文(改完保存并重启 dsh 生效);preset.yml 的 name 是预设显示名。做新人格:选一个预设点「复制」,填「预设 id」(=文件夹名,字母/数字开头,可含 - _) 和「人设名」(中文随意),保存后自动生成新预设文件夹。'
@@ -2663,7 +2663,7 @@ var QQS_THEME_CSS = [
2663
2663
  busy = true
2664
2664
  var act = btn.getAttribute('data-act')
2665
2665
  btn.disabled = true
2666
- fetch('/api/qqbot-settings/approval/decide', {
2666
+ fetch('api/qqbot-settings/approval/decide', {
2667
2667
  method: 'POST', headers: { 'content-type': 'application/json' },
2668
2668
  body: JSON.stringify({ code: ap.code, act: act }),
2669
2669
  }).then(function (r) { return r.json().catch(function () { return null }) }).then(function (d) {
@@ -2703,7 +2703,7 @@ var QQS_THEME_CSS = [
2703
2703
  busy = true
2704
2704
  var i = Number(btn.getAttribute('data-i'))
2705
2705
  btn.disabled = true
2706
- fetch('/api/qqbot-settings/questions/decide', {
2706
+ fetch('api/qqbot-settings/questions/decide', {
2707
2707
  method: 'POST', headers: { 'content-type': 'application/json' },
2708
2708
  body: JSON.stringify({ key: q.key, optIdx: i }),
2709
2709
  }).then(function (r) { return r.json().catch(function () { return null }) }).then(function (d) {
@@ -2717,11 +2717,11 @@ var QQS_THEME_CSS = [
2717
2717
  function poll() {
2718
2718
  if (busy) return
2719
2719
  try {
2720
- fetch('/api/qqbot-settings/approval/pending').then(function (r) { return r.json().catch(function () { return null }) }).then(function (d) {
2720
+ fetch('api/qqbot-settings/approval/pending').then(function (r) { return r.json().catch(function () { return null }) }).then(function (d) {
2721
2721
  if (d && Array.isArray(d.pending)) renderAp(d.pending)
2722
2722
  else if (itemType === 'ap' && d && !d.ok) { if (root) root.style.display = 'none'; itemType = '' }
2723
2723
  }).catch(function () {})
2724
- fetch('/api/qqbot-settings/questions/pending').then(function (r) { return r.json().catch(function () { return null }) }).then(function (d) {
2724
+ fetch('api/qqbot-settings/questions/pending').then(function (r) { return r.json().catch(function () { return null }) }).then(function (d) {
2725
2725
  if (d && Array.isArray(d.pending)) renderQs(d.pending)
2726
2726
  else if (itemType === 'qs' && d && !d.ok) { if (root) root.style.display = 'none'; itemType = '' }
2727
2727
  }).catch(function () {})
@@ -2974,11 +2974,11 @@ var QQS_THEME_CSS = [
2974
2974
  })
2975
2975
  function esc(v) { return String(v == null ? '' : v).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;') }
2976
2976
  function api(path, q) {
2977
- var url = '/api/qqbot-settings/' + path + (q ? '?' + q : '')
2977
+ var url = 'api/qqbot-settings/' + path + (q ? '?' + q : '')
2978
2978
  return fetch(url).then(function (r) { return r.json().catch(function () { return null }) }).catch(function () { return null })
2979
2979
  }
2980
2980
  function apiPost(path, body) {
2981
- return fetch('/api/qqbot-settings/' + path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body || {}) })
2981
+ return fetch('api/qqbot-settings/' + path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body || {}) })
2982
2982
  .then(function (r) { return r.json().catch(function () { return null }) }).catch(function () { return null })
2983
2983
  }
2984
2984
  // ── 红点: 入群申请待审汇总(各实例 pending 数之和, 不弹窗) ──
@@ -3325,10 +3325,10 @@ var QQS_THEME_CSS = [
3325
3325
  var box = panel ? panel.querySelector('#dk-aff-box') : null
3326
3326
  var q = state.ns ? '?' + outNsQ() : ''
3327
3327
  Promise.all([
3328
- fetch('/api/qqbot-settings/affinity' + q).then(function (r) { return r.json() }).catch(function () { return {} }),
3328
+ fetch('api/qqbot-settings/affinity' + q).then(function (r) { return r.json() }).catch(function () { return {} }),
3329
3329
  // all=1&limit=50: 这张表是"按 key 左连接好感度", 只要 top N 的话排在 N 后面的人永远显示 "—"
3330
3330
  // (2026-09-15 主人问"小明不是有好感度吗, 怎么显示 0" —— 他 a=0.064 排第 9, 被 top8 截掉)。
3331
- fetch('/api/qqbot-settings/attitude' + q + (q ? '&' : '?') + 'all=1&limit=50').then(function (r) { return r.json() }).catch(function () { return {} })
3331
+ fetch('api/qqbot-settings/attitude' + q + (q ? '&' : '?') + 'all=1&limit=50').then(function (r) { return r.json() }).catch(function () { return {} })
3332
3332
  ]).then(function (rs) {
3333
3333
  var aff = (rs[0] && rs[0].items) || []
3334
3334
  var att = (rs[1] && rs[1].items) || []
@@ -3345,7 +3345,7 @@ var QQS_THEME_CSS = [
3345
3345
  }
3346
3346
  function refreshScoreList() {
3347
3347
  if (state.tab !== 'session') return
3348
- fetch('/api/qqbot-settings/value-scores' + scoreQuery())
3348
+ fetch('api/qqbot-settings/value-scores' + scoreQuery())
3349
3349
  .then(function (r) { return r.json() })
3350
3350
  .then(function (d) {
3351
3351
  var next = d && d.ok ? d : { items: [], total: 0 }
@@ -3385,7 +3385,7 @@ var QQS_THEME_CSS = [
3385
3385
  }
3386
3386
  // ✍️ 样例库编辑: 读现有内容(展开时才拉)
3387
3387
  function loadValueSamplesEditor() {
3388
- fetch('/api/qqbot-settings/value-samples' + (state.ns ? '?' + outNsQ() : ''))
3388
+ fetch('api/qqbot-settings/value-samples' + (state.ns ? '?' + outNsQ() : ''))
3389
3389
  .then(function (r) { return r.json() })
3390
3390
  .then(function (d) {
3391
3391
  var stat = panel ? panel.querySelector('#dk-vs-stat') : null
@@ -3402,7 +3402,7 @@ var QQS_THEME_CSS = [
3402
3402
  var hint = panel ? panel.querySelector('#dk-vs-hint') : null
3403
3403
  if (!ta) return
3404
3404
  if (hint) hint.textContent = '保存中…'
3405
- fetch('/api/qqbot-settings/value-samples', {
3405
+ fetch('api/qqbot-settings/value-samples', {
3406
3406
  method: 'POST', headers: { 'content-type': 'application/json' },
3407
3407
  body: JSON.stringify({ ns: state.ns, text: ta.value }),
3408
3408
  }).then(function (r) { return r.json() }).then(function (d) {
@@ -3421,9 +3421,9 @@ var QQS_THEME_CSS = [
3421
3421
  var nsq = state.ns ? '?' + outNsQ() : ''
3422
3422
  state.valueScores = null
3423
3423
  // 先让宿主重置本地模型状态,再查状态
3424
- fetch('/api/qqbot-settings/local-model/reset', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' })
3424
+ fetch('api/qqbot-settings/local-model/reset', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' })
3425
3425
  .catch(function () { /* reset 失败也继续查 */ })
3426
- .then(function () { return fetch('/api/qqbot-settings/local-model/status' + nsq) }).then(function (r) { return r.json() }).then(function (d) {
3426
+ .then(function () { return fetch('api/qqbot-settings/local-model/status' + nsq) }).then(function (r) { return r.json() }).then(function (d) {
3427
3427
  state.localModel = d && d.ok ? d : null
3428
3428
  paintBody()
3429
3429
  }).catch(function () { state.localModel = null; paintBody() })
@@ -3433,7 +3433,7 @@ var QQS_THEME_CSS = [
3433
3433
  state.lmCfg = (d && d.value && d.value.localModel) || null
3434
3434
  paintBody()
3435
3435
  }).catch(function () { state.lmCfg = null; paintBody() })
3436
- fetch('/api/qqbot-settings/value-scores' + scoreQuery())
3436
+ fetch('api/qqbot-settings/value-scores' + scoreQuery())
3437
3437
  .then(function (r) { return r.json() })
3438
3438
  .then(function (d) { state.valueScores = d && d.ok ? d : { items: [], total: 0 }; paintBody() })
3439
3439
  .catch(function () { state.valueScores = { items: [], total: 0 }; paintBody() })
@@ -3588,7 +3588,7 @@ var QQS_THEME_CSS = [
3588
3588
  // 📊 导出 Excel(2026-09-14 主人要"一键导出分享")—— 直接走 GET,让浏览器下载
3589
3589
  var affExport = panel.querySelector('#dk-aff-export')
3590
3590
  if (affExport) affExport.onclick = function () {
3591
- var url = '/api/qqbot-settings/export.xlsx' + (state.ns ? '?' + outNsQ() : '')
3591
+ var url = 'api/qqbot-settings/export.xlsx' + (state.ns ? '?' + outNsQ() : '')
3592
3592
  var a = document.createElement('a')
3593
3593
  a.href = url
3594
3594
  a.download = ''
@@ -3611,7 +3611,7 @@ var QQS_THEME_CSS = [
3611
3611
  return
3612
3612
  }
3613
3613
  if (h) h.textContent = '发给 AI 中…(' + (hit.scope === 'group' ? '群' : '私聊') + '「' + (hit.name || '') + '」)'
3614
- fetch('/api/qqbot-settings/value-samples/let-ai-write', {
3614
+ fetch('api/qqbot-settings/value-samples/let-ai-write', {
3615
3615
  method: 'POST', headers: { 'content-type': 'application/json' },
3616
3616
  body: JSON.stringify({ ns: hit.ns || state.ns, scope: hit.scope, peerId: hit.peerId }),
3617
3617
  }).then(function (r) { return r.json() }).then(function (d) {
@@ -3632,7 +3632,7 @@ var QQS_THEME_CSS = [
3632
3632
  if (dlBtn) dlBtn.onclick = function () {
3633
3633
  dlBtn.disabled = true
3634
3634
  hint('下载中…(约 23MB, 1~2 分钟, 面板别关)')
3635
- fetch('/api/qqbot-settings/local-model/download', {
3635
+ fetch('api/qqbot-settings/local-model/download', {
3636
3636
  method: 'POST', headers: { 'content-type': 'application/json' },
3637
3637
  body: JSON.stringify({ ns: state.ns }),
3638
3638
  }).then(function (r) { return r.json() }).then(function (d) {
@@ -5238,7 +5238,7 @@ var QQS_THEME_CSS = [
5238
5238
  + '</div>'
5239
5239
  if (state.qunQr) {
5240
5240
  h += '<div class="dk-row" style="justify-content:center;margin:8px 0">'
5241
- + '<img src="/api/qqbot-settings/qun-qr?t=' + Date.now() + '" alt="二维码" '
5241
+ + '<img src="api/qqbot-settings/qun-qr?t=' + Date.now() + '" alt="二维码" '
5242
5242
  + 'style="width:230px;height:230px;border:1px solid #e2d9ff;border-radius:8px;background:#fff;object-fit:contain">'
5243
5243
  + '</div>'
5244
5244
  + '<div class="dk-msg" style="text-align:center">用手机 QQ「扫一扫」,摄像头对着<b>这块屏幕</b>扫'
@@ -6002,7 +6002,7 @@ var QQS_THEME_CSS = [
6002
6002
  if (!s) return s
6003
6003
  if (/^(https?:|\/\/|\/api\/|data:|blob:)/i.test(s)) return s
6004
6004
  if (/^[A-Za-z]:[\\/]/.test(s) || /^\\\\/.test(s) || s.charAt(0) === '/') {
6005
- return '/api/qqbot-settings/chat/raw-media?p=' + encodeURIComponent(s)
6005
+ return 'api/qqbot-settings/chat/raw-media?p=' + encodeURIComponent(s)
6006
6006
  }
6007
6007
  return s
6008
6008
  }
@@ -6018,7 +6018,7 @@ var QQS_THEME_CSS = [
6018
6018
  if (!idm) return ''
6019
6019
  var dd = ''
6020
6020
  try { dd = curDataDir() || '' } catch (e) { dd = '' }
6021
- return '/api/qqbot-settings/sticker-img?id=' + encodeURIComponent(idm[1]) + (dd ? '&dataDir=' + encodeURIComponent(dd) : '')
6021
+ return 'api/qqbot-settings/sticker-img?id=' + encodeURIComponent(idm[1]) + (dd ? '&dataDir=' + encodeURIComponent(dd) : '')
6022
6022
  }
6023
6023
  // 2026-10-01: 状态行单独成函数 —— 增量追加新消息后只更新这行, 不重绘整个列表
6024
6024
  function updateChatStatus() {
@@ -6577,7 +6577,7 @@ var QQS_THEME_CSS = [
6577
6577
  var ext = chatFileExt(f)
6578
6578
  setChatStatus('正在上传 ' + (f.name || '文件') + '…')
6579
6579
  var q = 'ns=' + encodeURIComponent(state.ns || '') + '&ext=' + encodeURIComponent(ext)
6580
- fetch('/api/qqbot-settings/chat/upload-raw?' + q, {
6580
+ fetch('api/qqbot-settings/chat/upload-raw?' + q, {
6581
6581
  method: 'POST',
6582
6582
  headers: { 'content-type': 'application/octet-stream' },
6583
6583
  body: f,
@@ -6765,7 +6765,7 @@ var QQS_THEME_CSS = [
6765
6765
  var e = c[sid]
6766
6766
  if (e && Date.now() - e.at < (e.hit ? 10000 : 2000)) { try { cb(e.hit) } catch (e1) {} ; return }
6767
6767
  try {
6768
- fetch('/api/qqbot-settings/session-lookup?sessionId=' + encodeURIComponent(sid))
6768
+ fetch('api/qqbot-settings/session-lookup?sessionId=' + encodeURIComponent(sid))
6769
6769
  .then(function (r) { return r.json() })
6770
6770
  .then(function (d) {
6771
6771
  var hit = !!(d && d.hits && d.hits.length)
@@ -6825,7 +6825,7 @@ var QQS_THEME_CSS = [
6825
6825
  var body = { kind: info.kind, file: info.file, enabled: info.enabled }
6826
6826
  var cw = curWorkspaceCwd()
6827
6827
  if (cw) body.cwd = cw
6828
- fetch('/api/qqbot-settings/ext-toggle', {
6828
+ fetch('api/qqbot-settings/ext-toggle', {
6829
6829
  method: 'POST',
6830
6830
  credentials: 'same-origin',
6831
6831
  headers: { 'Content-Type': 'application/json' },
@@ -6860,7 +6860,7 @@ var QQS_THEME_CSS = [
6860
6860
  setLoadingMarket(true)
6861
6861
  var cw = curWorkspaceCwd()
6862
6862
  var qs = cw ? ('?cwd=' + encodeURIComponent(cw)) : ''
6863
- fetch('/api/qqbot-settings/market' + qs, { credentials: 'same-origin' })
6863
+ fetch('api/qqbot-settings/market' + qs, { credentials: 'same-origin' })
6864
6864
  .then(function (r) { return r.json() })
6865
6865
  .then(function (d) { if (d && d.ok) setMarket(d); else console.warn('[market] 读取失败', d) })
6866
6866
  .catch(function (e) { console.warn('[market] 异常', e) })
@@ -6878,7 +6878,7 @@ var QQS_THEME_CSS = [
6878
6878
  }
6879
6879
  function onInstall(info) {
6880
6880
  setBusyId(info.id)
6881
- marketPost('/api/qqbot-settings/market/install', { id: info.id })
6881
+ marketPost('api/qqbot-settings/market/install', { id: info.id })
6882
6882
  .then(function (r) {
6883
6883
  return r.text().then(function (txt) {
6884
6884
  var d = null
@@ -6908,7 +6908,7 @@ var QQS_THEME_CSS = [
6908
6908
  var cw = curWorkspaceCwd()
6909
6909
  var body = { proxy: String(proxyInput || '').trim() }
6910
6910
  if (cw) body.cwd = cw
6911
- fetch('/api/qqbot-settings/market/config', {
6911
+ fetch('api/qqbot-settings/market/config', {
6912
6912
  method: 'POST',
6913
6913
  credentials: 'same-origin',
6914
6914
  headers: { 'Content-Type': 'application/json' },
@@ -6931,7 +6931,7 @@ var QQS_THEME_CSS = [
6931
6931
 
6932
6932
  function onRemove(info) {
6933
6933
  setBusyId(info.id)
6934
- marketPost('/api/qqbot-settings/market/remove', { id: info.id })
6934
+ marketPost('api/qqbot-settings/market/remove', { id: info.id })
6935
6935
  .then(function (r) {
6936
6936
  return r.text().then(function (txt) {
6937
6937
  var d = null
@@ -6966,7 +6966,7 @@ var QQS_THEME_CSS = [
6966
6966
  var _qs = []
6967
6967
  if (_cwd) _qs.push('cwd=' + encodeURIComponent(_cwd))
6968
6968
  if (_sid) _qs.push('sid=' + encodeURIComponent(_sid))
6969
- var _url = '/api/qqbot-settings/extensions' + (_qs.length ? ('?' + _qs.join('&')) : '')
6969
+ var _url = 'api/qqbot-settings/extensions' + (_qs.length ? ('?' + _qs.join('&')) : '')
6970
6970
  fetch(_url, { credentials: 'same-origin' })
6971
6971
  .then(function (r) { return r.json() })
6972
6972
  .then(function (d) { if (!dead) { setData(d); setErr(d && d.ok === false ? (d.error || '未知错误') : ''); } })
@@ -7121,7 +7121,7 @@ var QQS_THEME_CSS = [
7121
7121
  setLoading(true); setErr('')
7122
7122
  var qs = '?kind=' + encodeURIComponent(kind) + '&file=' + encodeURIComponent(file)
7123
7123
  if (cwd) qs += '&cwd=' + encodeURIComponent(cwd)
7124
- fetch('/api/qqbot-settings/ext-panel' + qs, { credentials: 'same-origin' })
7124
+ fetch('api/qqbot-settings/ext-panel' + qs, { credentials: 'same-origin' })
7125
7125
  .then(function (r) { return r.json() })
7126
7126
  .then(function (d) {
7127
7127
  if (dead) return
@@ -7136,7 +7136,7 @@ var QQS_THEME_CSS = [
7136
7136
 
7137
7137
  function save() {
7138
7138
  setMsg(''); setErr('')
7139
- fetch('/api/qqbot-settings/ext-panel', {
7139
+ fetch('api/qqbot-settings/ext-panel', {
7140
7140
  method: 'POST',
7141
7141
  credentials: 'same-origin',
7142
7142
  headers: { 'Content-Type': 'application/json' },
@@ -8141,7 +8141,7 @@ var QQS_THEME_CSS = [
8141
8141
  var now = Date.now();
8142
8142
  if (sid === lastSid && now - lastAt < 5000) return;
8143
8143
  lastSid = sid; lastAt = now;
8144
- fetch("/api/qqbot-settings/workspace/sessions", { credentials: "same-origin" })
8144
+ fetch("api/qqbot-settings/workspace/sessions", { credentials: "same-origin" })
8145
8145
  .then(function (r) { return r.json(); })
8146
8146
  .then(function (d) {
8147
8147
  if (!d || d.ok !== true) { console.warn("[qqbot] /workspace/sessions 不可用:", d && d.error); return; }
@@ -8156,7 +8156,7 @@ var QQS_THEME_CSS = [
8156
8156
  function connect() {
8157
8157
  if (typeof EventSource === "undefined") return;
8158
8158
  var es;
8159
- try { es = new EventSource("/api/qqbot-settings/workspace/watch"); } catch (e) { console.warn("[qqbot] EventSource 构造失败:", e); return; }
8159
+ try { es = new EventSource("api/qqbot-settings/workspace/watch"); } catch (e) { console.warn("[qqbot] EventSource 构造失败:", e); return; }
8160
8160
  es.onopen = function () { console.log("[qqbot] workspace/watch 已连接(SSE)"); };
8161
8161
  es.onmessage = function (ev) {
8162
8162
  try {
@@ -9,12 +9,47 @@ export interface MediaRewriteResult {
9
9
  }
10
10
  export declare function lastMediaRewrite(): MediaRewriteResult | undefined;
11
11
  export declare function setMaterialTargetFactory(fn: (() => MdMediaTarget | undefined) | undefined): void;
12
+ /**
13
+ * 兜底降级(2026-10-30):把「本地图 markdown」改写成 `[MEDIA:image|本地路径]`。
14
+ * 素材上传不可用 / 单张上传失败时用 —— 让图走普通发图通道(file_type=1)真发出去,
15
+ * 而不是把 `![说明](D:\...\x.jpg)` 这段语法原样当文本发给群友。
16
+ */
17
+ /**
18
+ * 规范化 markdown 图片语法(2026-10-31,主人实测:整段语法被当文本发出):
19
+ *
20
+ * 模型经常写出**畸形**的图片语法,QQ 的 markdown 卡(msg_type=2)是严格解析的,
21
+ * 畸形就 400 → 回落纯文本 → 群友看到一堆语法。实测样本:
22
+ *
23
+ * ```
24
+ * ![再说我是大肥鱼 #350 #350
25
+ * #1500px
26
+ * #1500px](qqbot-media://image/v1/…)
27
+ * ```
28
+ *
29
+ * 三个问题:alt 里有换行、尺寸注释重复(同一个属性写 4 遍)、`](...)` 主体被折行断开。
30
+ *
31
+ * 这里统一收拾成合法形态:alt 压成单行、尺寸注释去重保留最多两个、src 去空白。
32
+ */
33
+ export declare function normalizeMarkdownImages(text: string): string;
12
34
  /**
13
35
  * 兜底降级(2026-10-30):把「本地图 markdown」改写成 `[MEDIA:image|本地路径]`。
14
36
  * 素材上传不可用 / 单张上传失败时用 —— 让图走普通发图通道(file_type=1)真发出去,
15
37
  * 而不是把 `![说明](D:\...\x.jpg)` 这段语法原样当文本发给群友。
16
38
  */
17
39
  export declare function localMarkdownImagesToMediaMarkers(text: string): string;
40
+ /**
41
+ * 兜底降级(2026-10-31,主人实测截图):把**任意** markdown 图片语法从要当纯文本发的内容里拿掉。
42
+ *
43
+ * 为什么要它:`localMarkdownImagesToMediaMarkers` 只认**本地路径**,而上传成功的图已经被改写成
44
+ * `qqbot-media://image/v1/...` 远程引用 —— 那种引用**只有 markdown 消息(msg_type=2)能渲染**,
45
+ * 一旦 markdown 通道失败、回落到普通文本,就会把整段
46
+ * `![说明 #350 #1500px](qqbot-media://image/v1/xxx)` 原样发到群里(群友看到一堆语法)。
47
+ *
48
+ * 处理策略(尽量不丢信息):
49
+ * - 本地路径的图 → 仍交给 `[MEDIA:image|路径]`(走普通发图通道真发出去);
50
+ * - 已经是 `qqbot-media://` / http(s) 的 → 纯文本发不出去,就把整段语法换成 `[图片]`(保留 alt 作说明)。
51
+ */
52
+ export declare function stripMarkdownImagesForPlainText(text: string): string;
18
53
  /**
19
54
  * 扫描文本里的 markdown 图片;本地路径的替换成 QQ 引用。
20
55
  * @param explicitTarget 调用方自己的句柄(优先);不传则用全局 factory
@@ -1 +1 @@
1
- {"version":3,"file":"md-media-rewrite.d.ts","sourceRoot":"","sources":["../../src/features/md-media-rewrite.ts"],"names":[],"mappings":"AAaA,OAAO,EAAgE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAUjH,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,wBAAgB,gBAAgB,IAAI,kBAAkB,GAAG,SAAS,CAAuB;AAQzF,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,SAAS,GAAG,IAAI,CAEhG;AAuCD;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAStE;AA+BD;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA0D9G"}
1
+ {"version":3,"file":"md-media-rewrite.d.ts","sourceRoot":"","sources":["../../src/features/md-media-rewrite.ts"],"names":[],"mappings":"AAaA,OAAO,EAAgE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAUjH,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,wBAAgB,gBAAgB,IAAI,kBAAkB,GAAG,SAAS,CAAuB;AAQzF,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,SAAS,GAAG,IAAI,CAEhG;AAuCD;;;;GAIG;AACH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAuB5D;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAStE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYpE;AA+BD;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA0D9G"}