Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

feat(entity): 实体资料页只展示可核对的身份,删掉散文简介

longmeidao0da0799d709c
diff --git a/src/peach/web_entity.py b/src/peach/web_entity.py
index 2f42d7df6..e6a4aca93 100644
--- a/src/peach/web_entity.py
+++ b/src/peach/web_entity.py
@@ -38,8 +38,7 @@ def q_entity(contract: WebContract, args):
metadata = json.loads(d.pop("metadata_json") or "{}")
except (TypeError, ValueError):
metadata = {}
- d["summary"] = metadata.get("summary") or ""
- d["metadata"] = {k: v for k, v in metadata.items() if k != "summary"}
+ d["metadata"] = metadata
d["aliases"] = [r[0] for r in c.execute(
"SELECT alias FROM entity_alias WHERE entity_id=? ORDER BY confidence DESC,alias",
(d["id"],),
diff --git a/tests/test_rm_web.py b/tests/test_rm_web.py
index bf17d2cfb..0338d2753 100644
--- a/tests/test_rm_web.py
+++ b/tests/test_rm_web.py
@@ -1081,6 +1081,9 @@ class WebDataTests(unittest.TestCase):
self.assertTrue(page["links"][0]["clickable"])
self.assertFalse(page["links"][1]["clickable"])
self.assertIsNone(page["links"][1]["url"])
+ # 实体契约里没有散文简介字段:资料页只展示可核对的身份、计数与链接。
+ # 自由文本没有来源和置信度,也没有复核入口,不属于真相字段。
+ self.assertNotIn("summary", page)
self.assertEqual(rm_web.q_items(
self.contract, {"performer": "Canonical Alice", "limit": "10"},
)["total"], 1)
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index cdf99a581..1721d234d 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -2615,6 +2615,9 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("body.entity-open .index{overflow-x:visible}")
self.assertNotIn("关联艺人", profile)
self.assertNotIn("相关标签", profile)
+ # 资料页只渲染可核对的身份、计数与链接,没有散文简介块,样式表里也不该
+ # 留下对应选择器。
+ self.assertPageLacks("entitysummary")
def test_entity_people_and_tags_match_home_vertical_rhythm(self):
# 首页末层按钮到标签为 18.5px;人物行保留 4px 滚动留白后只需 6px 外边距。
diff --git a/web/app.css b/web/app.css
index 327b67383..208c8cf2d 100644
--- a/web/app.css
+++ b/web/app.css
@@ -439,7 +439,6 @@ body.entity-open .index{overflow-x:visible}
line-height:1.2;letter-spacing:0;margin:0 0 9px;overflow-wrap:anywhere}.entityhero .alias b{color:var(--ink);font-weight:inherit}
.entityhero .alias{color:var(--muted);
font-size:var(--fs-md);line-height:1.45;margin-bottom:14px;overflow-wrap:anywhere}
-.entitysummary{font-size:var(--fs-lg);line-height:1.6;max-width:820px;color:var(--ink-2)}
.entitylinks{display:flex;flex-wrap:wrap;gap:8px;margin-top:17px;max-width:100%}
.entitylinks a,.entitylinks .private{min-width:0;max-width:100%;min-height:40px;border:1px solid var(--border-10);
border-radius:var(--pill-radius);padding:4px 12px 4px 4px;font-size:var(--fs-sm);text-decoration:none;color:var(--ink);
@@ -1943,7 +1942,6 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
.entityportrait{width:112px}.entityhero h2{font-size:var(--fs-xl)}
.entityhero>div:last-child{width:100%}
.entityhero .alias{margin-bottom:10px}
- .entitysummary{margin-inline:auto}
.entityhero .entitylinks{justify-content:center;margin-top:13px}
.stats h2{font-size:var(--fs-xl)}.stats .insightcopy h2{font-size:var(--fs-3xl)}
/* 窄屏下标题也得一起缩。`/follow` 渲染在 `#stats` 里,上面那条 `.stats h2`
diff --git a/web/app.js b/web/app.js
index 5c77f21f5..22f159033 100644
--- a/web/app.js
+++ b/web/app.js
@@ -5263,7 +5263,6 @@ async function openEntity(kind,name,push=true,requestedTag){
$('#index').innerHTML=`<div class="entityhero"><div class="entityportrait ${kind==='performer'||kind==='creator'?'':'square'}">${image}<span>${esc(name.slice(0,1))}</span></div>
<div><h2>${esc(d.canonical_name)}</h2>
<div class="alias">${(d.display_aliases||[]).length?`${d.display_aliases.map(esc).join(' / ')} · `:''}<b>${d.asset_count.toLocaleString()}</b> 个视频</div>
- ${d.summary?`<div class="entitysummary">${esc(d.summary)}</div>`:''}
${links?`<div class="entitylinks">${links}</div>`:''}</div></div>
${related?`<div class="entitymeta"><section aria-label="同台艺人"><div class="relatedpeople">${related}</div></section></div>`:''}
${(tags||mediaToggle)?`<section class="entitytagbar" aria-label="媒体与标签"><div class="entitytags">${mediaToggle}${tags}</div></section>`:''}