fix(prompt): prevent empty event header in nearby evidence attach
This commit is contained in:
@@ -580,7 +580,7 @@ function collectEvidenceGroupsForEvent(eventObj, l0Selected, l1ByFloor, usedL0Id
|
|||||||
* @returns {string} 格式化后的文本
|
* @returns {string} 格式化后的文本
|
||||||
*/
|
*/
|
||||||
function formatEventWithEvidence(eventItem, idx, evidenceGroups, causalById) {
|
function formatEventWithEvidence(eventItem, idx, evidenceGroups, causalById) {
|
||||||
const ev = eventItem.event || {};
|
const ev = eventItem?.event || eventItem || {};
|
||||||
const time = ev.timeLabel || "";
|
const time = ev.timeLabel || "";
|
||||||
const title = String(ev.title || "").trim();
|
const title = String(ev.title || "").trim();
|
||||||
const people = (ev.participants || []).join(" / ").trim();
|
const people = (ev.participants || []).join(" / ").trim();
|
||||||
@@ -986,7 +986,7 @@ async function buildVectorPrompt(store, recallResult, causalById, focusEntities,
|
|||||||
|
|
||||||
item.evidenceGroups.sort((a, b) => a.floor - b.floor);
|
item.evidenceGroups.sort((a, b) => a.floor - b.floor);
|
||||||
|
|
||||||
const newText = formatEventWithEvidence(item.event, 0, item.evidenceGroups, causalById);
|
const newText = formatEventWithEvidence(item, 0, item.evidenceGroups, causalById);
|
||||||
const newTokens = estimateTokens(newText);
|
const newTokens = estimateTokens(newText);
|
||||||
const delta = newTokens - item.tokens;
|
const delta = newTokens - item.tokens;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user