File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 :
Original file line number Diff line number Diff 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
5162class TestDetectConvoRoom :
5263 def test_technical_room (self ):
You can’t perform that action at this time.
0 commit comments