@@ -395,6 +395,7 @@ window.__ModuleLoader__.load({
395395 "memory.explorer.tabSettings": "设置",
396396 "memory.explorer.tabStatus": "状态",
397397 "memory.entities.count": "{n} 个实体",
398+ "memory.entities.countSampled": "列表只列最近 {shown} 个;上方总数是全库",
398399 "memory.entities.pick": "从左侧选择一个实体,查看它的属性与关系",
399400 // 搜索框有字但一条没筛出来时用它;与 entities.none(库里真没实体)分开,
400401 // 否则「暂无实体」会把打错一个字误导成「你还没开抽取」。
@@ -1231,6 +1232,7 @@ window.__ModuleLoader__.load({
12311232 "memory.explorer.tabSettings": "Settings",
12321233 "memory.explorer.tabStatus": "Status",
12331234 "memory.entities.count": "{n} entities",
1235+ "memory.entities.countSampled": "The list shows the newest {shown} only; the total above is the whole library",
12341236 "memory.entities.pick": "Select an entity to see its attributes and relations",
12351237 "memory.entities.noMatch": "No entities match that search — try another word",
12361238 "memory.entities.none": "No entities yet — turn on entity extraction and people / projects / concepts will accumulate here",
@@ -2067,6 +2069,9 @@ window.__ModuleLoader__.load({
20672069 // 低于详情抽屉(6),下拉菜单/导入对话框随容器整体上浮。
20682070 ".mneme-xtools{position:absolute;right:14px;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:8px;padding:0;z-index:3}",
20692071 ".mneme-xcount{flex:none;font-size:12px;line-height:16px;color:var(--mneme-fg-dim);white-space:nowrap}",
2072+ // 目录计数下面那行小字:说清「总数是全库、列表只列最近 N 个」,两个口径
2073+ // 不一样不能只靠一个数字冒充(实体页此前就吃到这个亏)。
2074+ ".mneme-xcountnote{font-size:11px;line-height:15px;color:var(--mneme-fg-dim);white-space:nowrap}",
20702075 // --- three-column browse layout: hairline separators, no outer box ---
20712076 ".mneme-xmain{flex:1;min-height:0;display:flex;flex-direction:row;overflow:hidden}",
20722077 ".mneme-xside{flex:none;width:264px;min-width:0;min-height:0;overflow-y:auto;overflow-x:hidden;padding:16px 14px;border-right:1px solid var(--dsw-alias-border-l2);box-sizing:border-box;display:flex;flex-direction:column;gap:8px}",
@@ -2901,6 +2906,12 @@ window.__ModuleLoader__.load({
29012906 // ④ 关系图谱 the same ego graph the old graph-only tab drew
29022907 function EntityPanel({ t, focusEntity, onJumpMemory }) {
29032908 const [entities, setEntities] = useState(null);
2909+ // 目录只取最近 500 个(limit=500),可「一共抽出多少实体」问的是全库。
2910+ // 后端回 total + totalExact(见 src/api.js 的 /entities),这里必须用全库数,
2911+ // 否则左侧栏永远显示「500 个实体」——那正是「实体太少」这个观感的另一半来源:
2912+ // 状态页已经在 #559 修正,实体页这一处当时漏了。null = 全库数读不到(老宿主
2913+ // 或计数失败),此时退回切片长度并如实标成切片口径,不冒充全库。
2914+ const [entityTotal, setEntityTotal] = useState(null);
29042915 const [railQuery, setRailQuery] = useState("");
29052916 const [entityName, setEntityName] = useState(focusEntity || "");
29062917 const [depth, setDepth] = useState(1);
@@ -2923,8 +2934,12 @@ window.__ModuleLoader__.load({
29232934 let cancelled = false;
29242935 apiFetch("/api/dsh-mneme/entities?limit=500")
29252936 .then((r) => (r.ok ? r.json() : { entities: [] }))
2926- .then((j) => { if (!cancelled) setEntities(Array.isArray(j.entities) ? j.entities : []); })
2927- .catch(() => { if (!cancelled) setEntities([]); });
2937+ .then((j) => {
2938+ if (cancelled) return;
2939+ setEntities(Array.isArray(j.entities) ? j.entities : []);
2940+ setEntityTotal(j.totalExact === true && typeof j.total === "number" ? j.total : null);
2941+ })
2942+ .catch(() => { if (!cancelled) { setEntities([]); setEntityTotal(null); } });
29282943 return () => { cancelled = true; };
29292944 }, []);
29302945
@@ -3176,8 +3191,13 @@ window.__ModuleLoader__.load({
31763191 value: railQuery,
31773192 onChange: (e) => setRailQuery(e.target.value)
31783193 }),
3194+ // 大数字用全库数;全库数读不到(老宿主 / 计数失败)时退回切片长度,
3195+ // 但那只是「这次取回多少」,所以要多一行脚注说清列表本身只列最近 500 个。
31793196 entities !== null && entities.length > 0 && h("div", { className: "mneme-xcount" },
3180- t("memory.entities.count").replace("{n}", String(entities.length)))
3197+ t("memory.entities.count").replace("{n}", String(entityTotal !== null ? entityTotal : entities.length))),
3198+ entities !== null && entityTotal !== null && entityTotal > entities.length
3199+ && h("div", { className: "mneme-xcountnote" },
3200+ t("memory.entities.countSampled").replace("{shown}", String(entities.length)))
31813201 ),
31823202 h("div", { className: "mneme-entrailbody" },
31833203 entities === null && h("div", { className: "mneme-xempty" }, "…"),
0 commit comments