fix(fam-edge): 人物标识清洗 - _clean_person 去括号注释(防模型输出'人物A(别名/标识:人物B)'污染人物表);prompt 明确 people 只填标识本身;events.people 与 people_mentioned 均清洗
This commit is contained in:
@@ -126,6 +126,16 @@ def validate_video(path: str) -> tuple:
|
||||
return False, f"validate_exc: {e}", None
|
||||
|
||||
|
||||
def _clean_person(s: str) -> str:
|
||||
"""清洗人物标识:去掉括号注释(如 "人物A(别名/标识:人物B)" -> "人物A")。"""
|
||||
s = (s or '').strip()
|
||||
for sep in ('(', '('):
|
||||
if sep in s:
|
||||
s = s.split(sep, 1)[0].strip()
|
||||
break
|
||||
return s
|
||||
|
||||
|
||||
class VideoProcessor:
|
||||
def __init__(self, db: oracle_db.OracleDB):
|
||||
self.config = load_config()
|
||||
@@ -244,11 +254,15 @@ class VideoProcessor:
|
||||
norm_events.append({
|
||||
"timestamp": abs_ts,
|
||||
"description": str(ev.get('description', '')),
|
||||
"people": [str(p) for p in ev.get('people', []) if p],
|
||||
"people": [_clean_person(str(p)) for p in ev.get('people', []) if p],
|
||||
"is_attention_event": bool(ev.get('is_attention_event', False)),
|
||||
})
|
||||
offsets.append(off)
|
||||
|
||||
# 清洗 people_mentioned(去掉括号注释串,防污染人物表/合并)
|
||||
people = [_clean_person(str(p)) for p in people if p]
|
||||
people = [p for p in people if p and p not in ('无人', '无')]
|
||||
|
||||
event_ids = self.db.mark_video_processed(video_id, summary, norm_events, people, provider)
|
||||
# 缩略图 + 每个事件对应时间点的画面截图(用相对偏移直接定位,避免模型绝对时间误差)
|
||||
if vrow and vrow['local_path']:
|
||||
|
||||
Reference in New Issue
Block a user