Skip to content

Commit d52d6c9

Browse files
authored
fix: store full AI response in convo_miner exchange chunking (#695)
1 parent 091c2fe commit d52d6c9

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

mempalace/convo_miner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _chunk_by_exchange(lines: list) -> list:
7070
ai_lines.append(next_line.strip())
7171
i += 1
7272

73-
ai_response = " ".join(ai_lines[:8])
73+
ai_response = " ".join(ai_lines)
7474
content = f"{user_turn}\n{ai_response}" if ai_response else user_turn
7575

7676
if len(content.strip()) > MIN_CHUNK_SIZE:

tests/test_convo_miner_unit.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ def test_short_content_skipped(self):
4747
# Too short to produce chunks (below MIN_CHUNK_SIZE)
4848
assert isinstance(chunks, list)
4949

50+
def test_long_ai_response_not_truncated(self):
51+
"""AI responses longer than 8 lines must be stored in full (verbatim principle)."""
52+
lines = [f"Step {i}: important detail that must be stored" for i in range(1, 14)]
53+
content = "> How do I implement authentication?\n" + "\n".join(lines)
54+
chunks = chunk_exchanges(content)
55+
assert len(chunks) >= 1
56+
stored = chunks[0]["content"]
57+
# All 13 lines must be present — none silently dropped
58+
for i in range(1, 14):
59+
assert f"Step {i}:" in stored, f"Step {i} was truncated and not stored"
60+
5061

5162
class TestDetectConvoRoom:
5263
def test_technical_room(self):

0 commit comments

Comments
 (0)