Преглед изворни кода

fix: keep AI incremental notifications to new items (#1008)

* fix: keep AI incremental notifications to new items

* Delete tests/test_ai_incremental_report_data.py

---------

Co-authored-by: sansan <77180927+sansan0@users.noreply.github.com>
bing-h пре 2 месеци
родитељ
комит
1b41881ec4
1 измењених фајлова са 6 додато и 0 уклоњено
  1. 6 0
      trendradar/context.py

+ 6 - 0
trendradar/context.py

@@ -1044,6 +1044,12 @@ class AppContext:
                         if item_source_id in new_titles:
                             is_new = item_title in new_titles[item_source_id]
 
+                # incremental 模式下仅保留本轮新增命中的条目。
+                # run_ai_filter() 返回的是 active 结果集合,因此这里需要
+                # 显式过滤掉历史已命中的旧条目,才能与 keyword 模式行为对齐。
+                if mode == "incremental" and not is_new:
+                    continue
+
                 title_entry = {
                     "title": item.get("title", ""),
                     "source_name": item.get("source_name", ""),