From e18e249d5da3d8fe701a885edc64341cc5dbf813 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 23 Jul 2026 03:39:30 -0400 Subject: [PATCH] refac --- backend/open_webui/tools/knowledge_fs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/tools/knowledge_fs.py b/backend/open_webui/tools/knowledge_fs.py index 0ec1cc8983..44d092e792 100644 --- a/backend/open_webui/tools/knowledge_fs.py +++ b/backend/open_webui/tools/knowledge_fs.py @@ -686,12 +686,12 @@ async def _kb_grep( # Grep on piped input if piped_input is not None: - lines = piped_input.split('\\n') + lines = piped_input.split('\n') matched = [] for i, line in enumerate(lines, 1): if _matches(line): matched.append(f'{i}: {line}') - return '\\n'.join(matched) if matched else f'No matches for "{pattern}"' + return '\n'.join(matched) if matched else f'No matches for "{pattern}"' # Single file grep if file_ref and not dir_scope: @@ -702,7 +702,7 @@ async def _kb_grep( elif 'error' in resolved: return resolved['error'] else: - lines = resolved['content'].split('\\n') + lines = resolved['content'].split('\n') matched = [] for i, line in enumerate(lines, 1): if _matches(line): @@ -715,7 +715,7 @@ async def _kb_grep( if not matched: return f'No matches for "{pattern}" in {resolved["filename"]}' - return '\\n'.join(matched) + return '\n'.join(matched) # Cross-file grep (optionally scoped to directory) accessible = await _get_accessible_files(user, model_knowledge)