This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-23 03:39:30 -04:00
1 parent af629177f4
commit e18e249d5d
1 file changed
+4 -4
+4 -4
View File
@@ -686,12 +686,12 @@ async def _kb_grep(
# Grep on piped input # Grep on piped input
if piped_input is not None: if piped_input is not None:
lines = piped_input.split('\\n') lines = piped_input.split('\n')
matched = [] matched = []
for i, line in enumerate(lines, 1): for i, line in enumerate(lines, 1):
if _matches(line): if _matches(line):
matched.append(f'{i}: {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 # Single file grep
if file_ref and not dir_scope: if file_ref and not dir_scope:
@@ -702,7 +702,7 @@ async def _kb_grep(
elif 'error' in resolved: elif 'error' in resolved:
return resolved['error'] return resolved['error']
else: else:
lines = resolved['content'].split('\\n') lines = resolved['content'].split('\n')
matched = [] matched = []
for i, line in enumerate(lines, 1): for i, line in enumerate(lines, 1):
if _matches(line): if _matches(line):
@@ -715,7 +715,7 @@ async def _kb_grep(
if not matched: if not matched:
return f'No matches for "{pattern}" in {resolved["filename"]}' return f'No matches for "{pattern}" in {resolved["filename"]}'
return '\\n'.join(matched) return '\n'.join(matched)
# Cross-file grep (optionally scoped to directory) # Cross-file grep (optionally scoped to directory)
accessible = await _get_accessible_files(user, model_knowledge) accessible = await _get_accessible_files(user, model_knowledge)