dsh-plugin-soulbridge 0.0.107 → 0.0.108
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/index.js +11 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -484,6 +484,7 @@ export function mentions(text, entity) {
|
|
|
484
484
|
export function buildFactHooks(text, options = {}) {
|
|
485
485
|
const parts = [];
|
|
486
486
|
const used = [];
|
|
487
|
+
let sawInferred = false;
|
|
487
488
|
try {
|
|
488
489
|
const known = ensureSoul().findEntities('', 50);
|
|
489
490
|
// The entity timeline already covers the subject of an entity question;
|
|
@@ -499,7 +500,11 @@ export function buildFactHooks(text, options = {}) {
|
|
|
499
500
|
if (seen.has(fact.id)) continue;
|
|
500
501
|
seen.add(fact.id);
|
|
501
502
|
const when = fact.atText ?? (fact.at ? new Date(fact.at).toISOString().slice(0, 10) : '');
|
|
502
|
-
|
|
503
|
+
// ADR 0035: a fact from my side of the exchange is inferred. Two characters plus one
|
|
504
|
+
// explanation below the block, because a per-line sentence would double the text.
|
|
505
|
+
const marker = fact.source === 'inferred' ? '我: ' : '';
|
|
506
|
+
if (marker) sawInferred = true;
|
|
507
|
+
lines.push(`- ${marker}[${fact.id}] ${escapeBlockText(fact.statement)}${when ? `(${escapeBlockText(when)})` : ''}`);
|
|
503
508
|
used.push(fact.id);
|
|
504
509
|
}
|
|
505
510
|
if (lines.length > 0) {
|
|
@@ -510,6 +515,11 @@ export function buildFactHooks(text, options = {}) {
|
|
|
510
515
|
log(`prestep: hooks failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
511
516
|
}
|
|
512
517
|
if (parts.length === 0) return '';
|
|
518
|
+
if (sawInferred) {
|
|
519
|
+
parts.push(
|
|
520
|
+
'<source-notes>以「我:」开头的是我上一轮说的话,未经用户确认;没标的都是用户说的。</source-notes>',
|
|
521
|
+
);
|
|
522
|
+
}
|
|
513
523
|
return { text: parts.join('\n\n'), used };
|
|
514
524
|
}
|
|
515
525
|
|