feat: 更新 FaceFilterSettings 为三段式统一结构

数据模型更新:
- 新增 UiFilterRules 结构(UI 过滤规则)
- 新增 ProcessingThresholds 结构(处理阈值)
- 新增 TraceSettings 结构(Trace 配置)
- FaceFilterSettings 整合三个子结构
- min_confidence 范围从 0-100 改为 0.0-1.0
- min_size 重命名为 min_bbox_size
- 新增字段: max_confidence, max_bbox_size, source, backend_status

向后兼容性:
- 新增 from_legacy() 方法自动转换旧格式
- defaults() 方法自动转换 0-100 到 0.0-1.0

测试:
- 更新 test_face_filter_roundtrip
- 更新 test_face_filter_defaults_match_detection_defaults
- 新增 test_face_filter_new_method
- 新增 test_face_filter_from_legacy
- 所有测试通过 ✅

文件修改:
- src/core/file_profile.rs: 数据结构定义(+150 行)
- src/core/processor/vlm_summary.rs: 字段访问更新
- src/api/identities.rs: 字段访问更新
- src/api/profile.rs: 字段访问更新(3 处)
- migrations/20261009_face_filter_v2.sql: 数据库迁移脚本

状态: P0 第 1 个文件完成
This commit is contained in:
Accusys
2026-10-09 14:42:26 +08:00
parent ed95c447a9
commit 86c776ce41
5 changed files with 279 additions and 35 deletions
+1 -1
View File
@@ -557,7 +557,7 @@ async fn list_unassigned_traces(
let sorted_traces: Vec<_> = sorted_traces
.into_iter()
.filter(|((file_uuid, _), agg)| {
if agg.frame_count == 1 && !settings.single_frame_trace_unassigned_enabled {
if agg.frame_count == 1 && !settings.trace_settings.single_frame_trace_unassigned_enabled {
// Check if this file_uuid matches the query file_uuid
if let Some(ref query_file_uuid) = query.file_uuid {
if file_uuid == query_file_uuid {
+5 -5
View File
@@ -1257,13 +1257,13 @@ pub async fn get_face_groups_handler(
for (name, trace_id, frame_count) in rows {
// Filter single frame traces if disabled
if frame_count == Some(1) {
if !settings.single_frame_trace_group_enabled
if !settings.trace_settings.single_frame_trace_group_enabled
&& !name.starts_with("Face Trace ")
&& !name.starts_with("Trace ")
{
continue;
}
if !settings.single_frame_trace_unassigned_enabled
if !settings.trace_settings.single_frame_trace_unassigned_enabled
&& (name.starts_with("Face Trace ") || name.starts_with("Trace "))
{
continue;
@@ -1282,7 +1282,7 @@ pub async fn get_face_groups_handler(
for (name, trace_ids) in groups {
let is_auto_name = name.starts_with("Person_");
let should_filter =
settings.single_trace_group_filter_enabled && trace_ids.len() == 1 && is_auto_name;
settings.trace_settings.single_trace_group_filter_enabled && trace_ids.len() == 1 && is_auto_name;
if !should_filter {
filtered_groups.insert(name, trace_ids);
@@ -1409,7 +1409,7 @@ pub async fn get_cluster_results_handler(
let mut groups: HashMap<String, Vec<i32>> = HashMap::new();
for (name, trace_id, frame_count) in rows {
// Filter out single frame traces if disabled
if frame_count == Some(1) && !settings.single_frame_trace_group_enabled {
if frame_count == Some(1) && !settings.trace_settings.single_frame_trace_group_enabled {
continue;
}
@@ -1424,7 +1424,7 @@ pub async fn get_cluster_results_handler(
for (name, trace_ids) in groups {
let is_auto_name = name.starts_with("Person_");
let should_filter =
settings.single_trace_group_filter_enabled && trace_ids.len() == 1 && is_auto_name;
settings.trace_settings.single_trace_group_filter_enabled && trace_ids.len() == 1 && is_auto_name;
if !should_filter {
filtered_groups.insert(name, trace_ids);