n8n 連携: 続きのセッションに写された同じ区間を 1 件にまとめる

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 06:22:09 +09:00
co-authored by Claude Opus 5.5
parent febab50f7e
commit c37622fdba
2 changed files with 18 additions and 2 deletions
+8 -2
View File
@@ -1312,8 +1312,14 @@ def collect_blocks(store, project_id, start, end, gap_min=N8N_GAP_MIN, min_min=N
}
)
out.append(block)
out.sort(key=lambda b: b["startEpoch"])
return out
# 会話を続けると新しいセッションのファイルに前の履歴が同じ時刻のまま写されるので、
# 開始時刻 (ミリ秒) が同じ区間は写しとみなし、いちばん後まで続いているものだけを残す。
unique = {}
for block in out:
key = int(round(block["startEpoch"] * 1000))
if key not in unique or block["endEpoch"] > unique[key]["endEpoch"]:
unique[key] = block
return sorted(unique.values(), key=lambda b: b["startEpoch"])
def mark_blocks(blocks, rows, deleted_sources, now=None):