fix(优先组): #18 密钥明文直配 config(弃 .env 依赖);#5 appearances 改 distinct 视频数覆盖校准(防 reconcile 累加膨胀);#9 oracle_sync 拉取加锁防 trigger_now 与后台并发双拉;#11 LLM 合并命名解析 target 已有 canonical(统一显示名)
This commit is contained in:
@@ -243,6 +243,26 @@ class OracleDB:
|
||||
"""手动命名:设置规范名(label 可视为别名)。"""
|
||||
self.upsert_person(label, canonical_name, source='manual')
|
||||
|
||||
def set_person_appearances(self, label: str, count: int, source: str = 'llm'):
|
||||
"""覆盖设置出现次数(reconcile 时用 distinct 视频数校准,避免累加膨胀)。"""
|
||||
now = _now_iso()
|
||||
row = self._conn.execute("SELECT * FROM people WHERE label=?", (label,)).fetchone()
|
||||
if row:
|
||||
if source == 'manual' or row['source'] != 'manual':
|
||||
self._conn.execute(
|
||||
"UPDATE people SET appearances=?, source=?, updated_at=? WHERE label=?",
|
||||
(int(count), source, now, label))
|
||||
else:
|
||||
self._conn.execute(
|
||||
"UPDATE people SET appearances=?, updated_at=? WHERE label=?",
|
||||
(int(count), now, label))
|
||||
else:
|
||||
self._conn.execute(
|
||||
"INSERT INTO people (label, canonical_name, first_seen, appearances, "
|
||||
"source, updated_at) VALUES (?,?,?,?,?,?)",
|
||||
(label, '', now, int(count), source, now))
|
||||
self._conn.commit()
|
||||
|
||||
def get_people(self) -> List[sqlite3.Row]:
|
||||
return self._conn.execute("SELECT * FROM people ORDER BY id ASC").fetchall()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user