From 8af9dc3ee1167f897d40bf1a9eca2683d290f5d1 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Sat, 26 Oct 2024 10:45:42 -0700 Subject: [PATCH] Unescape special characters in prompt traces for better readability --- src/khoj/processor/conversation/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/khoj/processor/conversation/utils.py b/src/khoj/processor/conversation/utils.py index 710de9ff..a1c8d0a4 100644 --- a/src/khoj/processor/conversation/utils.py +++ b/src/khoj/processor/conversation/utils.py @@ -431,6 +431,8 @@ def commit_conversation_trace( # Write files and stage them for filename, content in files_to_commit.items(): file_path = os.path.join(repo_path, filename) + # Unescape special characters in content for better readability + content = content.strip().replace("\\n", "\n").replace("\\t", "\t") with open(file_path, "w", encoding="utf-8") as f: f.write(content) repo.index.add([filename])