Skip to content

Commit dbeba70

Browse files
committed
fix handler
1 parent 3f08634 commit dbeba70

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

integrations/github/src/haystack_integrations/tools/github/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ def message_handler(documents: list[Document], max_length: int = 150_000) -> str
2121
result_str = ""
2222
for document in documents:
2323
if document.meta["type"] in ["file", "dir", "error"]:
24-
result_str += document.content or "" + "\n"
24+
result_str += (document.content or "") + "\n"
2525
else:
2626
result_str += f"File Content for {document.meta['path']}\n\n"
2727
result_str += document.content or ""
2828

2929
if len(result_str) > max_length:
3030
result_str = result_str[:max_length] + "...(large file can't be fully displayed)"
3131

32-
return result_str
32+
return result_str.strip()
3333

3434

3535
def serialize_handlers(

integrations/github/tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class TestMessageHandler:
2020
Document(content="docs", meta={"type": "dir"}),
2121
Document(content="README.md", meta={"type": "file"}),
2222
],
23-
"docsREADME.md",
23+
"docs\nREADME.md",
2424
),
2525
(
2626
[Document(content="print('hi')", meta={"type": "file_content", "path": "main.py"})],

0 commit comments

Comments
 (0)