dsh-aurorix-agentbook 1.7.0 → 1.7.1
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/lib/web.js +5 -2
- package/package.json +1 -1
package/lib/web.js
CHANGED
|
@@ -186,7 +186,8 @@ const ORDER = ['soul','rules','profile','explicit','long_term','episodic'];
|
|
|
186
186
|
const $ = (id) => document.getElementById(id);
|
|
187
187
|
const esc = (v) => String(v == null ? '' : v).replace(/[&<>"]/g, (c) => ({'&':'&','<':'<','>':'>','"':'"'}[c]));
|
|
188
188
|
const fmtTotal = (n) => ${JSON.stringify(zh ? '共 ' : '')} + n + ${JSON.stringify(zh ? ' 条' : ' records')};
|
|
189
|
-
const fmtHits = (n, tot) => ${JSON.stringify(zh ? '命中 ' : '')} + n + ${JSON.stringify(zh ? ' 条(共 ' : ' hits (of ')} + tot + ${JSON.stringify(zh ? ' 条)' : ')')}
|
|
189
|
+
const fmtHits = (n, tot, loose) => ${JSON.stringify(zh ? '命中 ' : '')} + n + ${JSON.stringify(zh ? ' 条(共 ' : ' hits (of ')} + tot + ${JSON.stringify(zh ? ' 条)' : ')')}
|
|
190
|
+
+ (loose ? ${JSON.stringify(zh ? ';整句太严,已放宽成任一词匹配' : '; all-word match was too strict, so any word counts')} : '');
|
|
190
191
|
const fmtVault = (shown, total) => ${JSON.stringify(zh ? '共 ' : '')} + total + ${JSON.stringify(zh ? ' 条,显示 ' : ' total, ')} + shown + ${JSON.stringify(zh ? ' 条' : ' shown')};
|
|
191
192
|
|
|
192
193
|
let D = null, EDITING = false, VAULT_ALL = [], searchEpoch = 0, detailEpoch = 0, vaultReady = false;
|
|
@@ -328,7 +329,7 @@ $('go').onclick = async () => {
|
|
|
328
329
|
const hits = Array.isArray(s.hits) ? s.hits : [];
|
|
329
330
|
if (q === '') { renderMemoryList($('results'), hits, s.listError ? T.fail + s.listError : T.none, (row) => openDetail(row, 'memory')); return; }
|
|
330
331
|
$('results').innerHTML = hits.length === 0 ? '<div class="hint">' + esc(T.noHit) + '</div>'
|
|
331
|
-
: '<div class="hint">' + fmtHits(hits.length, s.searchTotal ?? s.total ?? 0) + '</div>' + hits.map((r, i) =>
|
|
332
|
+
: '<div class="hint">' + fmtHits(hits.length, s.searchTotal ?? s.total ?? 0, s.searchLoose === true) + '</div>' + hits.map((r, i) =>
|
|
332
333
|
'<div class="item" data-i="' + i + '">' + DOC + '<div class="txt"><div class="t">' + esc(r.title || '') +
|
|
333
334
|
'</div><div class="m">' + esc((r.plane || '') + ' · ' + String(r.preview || '').slice(0, 90)) + '</div></div><div class="chev">›</div></div>').join('');
|
|
334
335
|
[...$('results').querySelectorAll('.item')].forEach((n) => { n.onclick = () => openDetail(hits[Number(n.dataset.i)], 'memory'); });
|
|
@@ -595,6 +596,8 @@ export function createWebHandler({ backend, connection }) {
|
|
|
595
596
|
hasCredentialPlane: context.ok && context.hasCredentialPlane === true,
|
|
596
597
|
statsError: context.ok ? undefined : context.reason,
|
|
597
598
|
searchTotal: result.total ?? result.items.length,
|
|
599
|
+
// 这一轮补过 OR 兜底时告诉页面,让用户知道命中数为什么变多。
|
|
600
|
+
searchLoose: result.loose === true,
|
|
598
601
|
hits: (result.items ?? []).map((x) => ({ id: x.id, title: x.title, plane: x.plane, preview: x.preview ?? '' })),
|
|
599
602
|
})
|
|
600
603
|
return
|