吸收数字员工长期记忆闭环
This commit is contained in:
@@ -496,11 +496,25 @@ function buildBusinessView(
|
||||
run_id: stringField(record.runId ?? record.run_id) || null,
|
||||
decision: stringField(record.decision) || null,
|
||||
};
|
||||
case "memory":
|
||||
return {
|
||||
...base,
|
||||
key: stringField(record.key) || row.entity_id,
|
||||
category: stringField(record.category) || null,
|
||||
source: stringField(record.source) || null,
|
||||
content_preview: compactPreview(stringField(record.content) || summary?.summary || ""),
|
||||
};
|
||||
default:
|
||||
return base;
|
||||
}
|
||||
}
|
||||
|
||||
function compactPreview(value: string, maxLength = 120): string | null {
|
||||
const compact = value.replace(/\s+/g, " ").trim();
|
||||
if (!compact) return null;
|
||||
return compact.length > maxLength ? `${compact.slice(0, maxLength)}...` : compact;
|
||||
}
|
||||
|
||||
function markRowsSyncing(rows: OutboxRow[], now: string): void {
|
||||
const db = getDigitalEmployeeDb();
|
||||
if (!db) return;
|
||||
@@ -774,6 +788,8 @@ function entitySummarySelect(entityType: string): string | null {
|
||||
return "SELECT name AS title, kind AS status, uri AS summary, payload FROM digital_artifacts WHERE id = ?";
|
||||
case "approval":
|
||||
return "SELECT title, status, NULL AS objective, payload FROM digital_approvals WHERE id = ?";
|
||||
case "memory":
|
||||
return "SELECT key AS title, status, content AS summary, payload FROM digital_memories WHERE id = ?";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -876,6 +892,8 @@ function entityTable(entityType: string): string | null {
|
||||
return "digital_artifacts";
|
||||
case "approval":
|
||||
return "digital_approvals";
|
||||
case "memory":
|
||||
return "digital_memories";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user