deepseek-plastic-memory 3.4.2 → 3.4.4

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/memtree.mjs CHANGED
@@ -136,17 +136,23 @@ function cmdTLog(args) {
136
136
  console.log('ok 今天第一条')
137
137
  }
138
138
  function cmdSearch(args) {
139
- const q = txt(args.join(' ')).toLowerCase()
140
- if (!q) return console.log('给个关键词')
139
+ const raw = txt(args.join(' '))
140
+ if (!raw) return console.log('给个关键词')
141
+ // 按空格拆成多个词,每个词都只要"包含"即可(搜半个词、单个字也能命中)
142
+ const terms = raw.toLowerCase().split(/\s+/).filter(Boolean)
143
+ const hit = (text) => {
144
+ const t = String(text || '').toLowerCase()
145
+ return terms.every((w) => t.includes(w))
146
+ }
141
147
  const hits = []
142
148
  for (const f of S.folders) {
143
149
  const tag = f.parent ? f.parent + '>' + f.name : f.k + f.name
144
150
  for (const r of readNotes(f.k)) {
145
- if ((r.text || '').toLowerCase().includes(q)) hits.push(tag + ' ' + r.id + ' ' + (r.flag ? r.flag + ' ' : '') + r.text)
151
+ if (hit(r.text)) hits.push(tag + ' ' + r.id + ' ' + (r.flag ? r.flag + ' ' : '') + r.text)
146
152
  }
147
153
  }
148
154
  for (const x of readPending()) {
149
- if ((x.text || '').toLowerCase().includes(q)) hits.push('待审 ' + x.id + ' ' + x.text)
155
+ if (hit(x.text)) hits.push('待审 ' + x.id + ' ' + x.text)
150
156
  }
151
157
  console.log(hits.length ? hits.join(String.fromCharCode(10)) : '没找到')
152
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepseek-plastic-memory",
3
- "version": "3.4.2",
3
+ "version": "3.4.4",
4
4
  "description": "DeepSeek 可塑性记忆:给 DSH 用的分区式长期记忆,带遗忘曲线",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/public/sky/app.js CHANGED
@@ -1985,11 +1985,13 @@ function renderCurve() {
1985
1985
  let searchTimer = 0
1986
1986
  function onSearch(q) {
1987
1987
  state.query = q.trim().toLowerCase()
1988
+ const terms = state.query.split(/\s+/).filter(Boolean)
1988
1989
  state.matches = new Set()
1989
- if (state.query) {
1990
+ if (terms.length) {
1991
+ // 按词/字匹配:每个词只要出现在正文、分区名、主分区名里就算命中,不用搜整段
1990
1992
  for (const m of state.memories) {
1991
1993
  const hay = `${m.text || ''} ${m.folderName || ''} ${m.mainName || ''}`.toLowerCase()
1992
- if (hay.includes(state.query)) state.matches.add(m.id)
1994
+ if (terms.every((w) => hay.includes(w))) state.matches.add(m.id)
1993
1995
  }
1994
1996
  }
1995
1997
  setHot(state.query ? state.matches : (state.viewingMem ? [state.viewingMem.id] : null), 0.95)