dsh-fish-memory 1.4.4 → 1.4.6

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 (3) hide show
  1. package/lib/client.js +90 -0
  2. package/lib/index.js +6941 -6622
  3. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -179,6 +179,7 @@ const 洗键进度 = { 已: 0, 总: 0, 在跑: false, 干跑: false }
179
179
  const [notes, setNotes] = React.useState(null)
180
180
  const [busy, setBusy] = React.useState(false)
181
181
  const [confirm, setConfirm] = React.useState(null) // 正在等确认的删除(二次确认,手滑不了)
182
+ const [并入, set并入] = React.useState(null) // ⭐ 1.4.5:切成按工作区前的「合并预览」
182
183
  const [showDeleted, setShowDeleted] = React.useState(false)
183
184
  const [selfDraft, setSelfDraft] = React.useState({}) // 每个会话「她自己叫什么」的草稿
184
185
  const [ownerDraft, setOwnerDraft] = React.useState({}) // 每个会话「怎么称呼对方」的草稿
@@ -2690,6 +2691,47 @@ const 洗键进度 = { 已: 0, 总: 0, 在跑: false, 干跑: false }
2690
2691
  '那种一个字都没改,也不会再问一遍 ✓)',
2691
2692
  )
2692
2693
  : null,
2694
+ // ⭐ 1.4.5:切成「按工作区」之前的合并预览 —— 先看清楚要并什么,再决定
2695
+ 并入 && 并入.length
2696
+ ? React.createElement(
2697
+ 'div',
2698
+ { style: S.askBox },
2699
+ React.createElement(
2700
+ 'div',
2701
+ { style: { flex: 1 } },
2702
+ '切成「按工作区」要把这些会话的记忆并成一份:',
2703
+ React.createElement(
2704
+ 'div',
2705
+ { style: Object.assign({}, S.dim, { fontSize: 12, marginTop: 4, lineHeight: 1.7 }) },
2706
+ 并入.map((r) =>
2707
+ '· ' + r.叫什么 + ':' + r.会话数 + ' 间会话,共 ' + r.合计 + ' 条' +
2708
+ (r.去重 ? '(' + r.去重 + ' 条重复,并完 ' + r.并完 + ' 条)' : ''),
2709
+ ).join('\n'),
2710
+ ),
2711
+ React.createElement(
2712
+ 'div',
2713
+ { style: Object.assign({}, S.dim, { fontSize: 11, marginTop: 4 }) },
2714
+ '归档的会话不会并进来。旧库都留着 —— 想退回「按会话」随时能退。',
2715
+ ),
2716
+ ),
2717
+ React.createElement(
2718
+ 'button',
2719
+ {
2720
+ style: S.btnDanger,
2721
+ disabled: busy,
2722
+ onClick: () => {
2723
+ setBusy(true)
2724
+ post('/merge-workspace', { 试算: false })
2725
+ .then(() => post('/mode', { 模式: 'workspace' }))
2726
+ .then(() => { setBusy(false); set并入(null); load() })
2727
+ .catch(() => setBusy(false))
2728
+ },
2729
+ },
2730
+ busy ? '并着呢…' : '并进来',
2731
+ ),
2732
+ React.createElement('button', { style: S.btn, onClick: () => set并入(null) }, '算了'),
2733
+ )
2734
+ : null,
2693
2735
  confirm && confirm.kind === 'stable'
2694
2736
  ? React.createElement(
2695
2737
  'div',
@@ -3949,6 +3991,54 @@ const 洗键进度 = { 已: 0, 总: 0, 在跑: false, 干跑: false }
3949
3991
  : '全关着 —— 哪个会话都不记也不读,工具列表里也不会出现它。',
3950
3992
  ),
3951
3993
  ),
3994
+ // ⭐ 1.4.5:记忆按什么归类 —— 按会话 / 按工作区
3995
+ React.createElement(
3996
+ 'div',
3997
+ { style: Object.assign({}, S.row, S.条, { alignItems: 'center' }) },
3998
+ React.createElement(
3999
+ 'button',
4000
+ {
4001
+ style: Object.assign({}, S.btn, {
4002
+ flex: 'none',
4003
+ color: d.模式 === 'workspace' ? '#8fd0a0' : 'inherit',
4004
+ borderColor: d.模式 === 'workspace' ? 'rgba(143,208,160,.6)' : 'rgba(128,128,128,.35)',
4005
+ }),
4006
+ disabled: busy,
4007
+ onClick: () => {
4008
+ const 要切 = d.模式 === 'workspace' ? 'session' : 'workspace'
4009
+ if (要切 !== 'workspace') {
4010
+ // 切回按会话:不涉及合并,直接切
4011
+ setBusy(true)
4012
+ post('/mode', { 模式: 要切 }).then(() => { setBusy(false); load() }).catch(() => setBusy(false))
4013
+ return
4014
+ }
4015
+ // 切成按工作区:先**试算**(每间会话现有几条、并完剩几条),看清楚再决定
4016
+ setBusy(true)
4017
+ post('/merge-workspace', { 试算: true })
4018
+ .then((j) => {
4019
+ setBusy(false)
4020
+ const 报告 = (j && j.报告) || []
4021
+ if (!j || !j.ok || !报告.length) {
4022
+ // 没有可并的(都还是空的)→ 直接切
4023
+ setBusy(true)
4024
+ post('/mode', { 模式: 要切 }).then(() => { setBusy(false); load() }).catch(() => setBusy(false))
4025
+ return
4026
+ }
4027
+ set并入(报告)
4028
+ })
4029
+ .catch(() => setBusy(false))
4030
+ },
4031
+ },
4032
+ (d.模式 === 'workspace' ? '按工作区' : '按会话'),
4033
+ ),
4034
+ React.createElement(
4035
+ 'div',
4036
+ { style: Object.assign({}, S.dim, { flex: 1, minWidth: 0 }) },
4037
+ d.模式 === 'workspace'
4038
+ ? '整个工作区共用一个记忆库 —— 新开的会话自动接上,归档旧会话记忆也不会跟着走。'
4039
+ : '每个会话各记各的。会话开久了变卡、要归档换新会话时,切成「按工作区」就接得上了。',
4040
+ ),
4041
+ ),
3952
4042
  (d.sessions || []).map((s) =>
3953
4043
  React.createElement(
3954
4044
  'div',