From 8b03d93fd5d6773a6f2dee73a1c67b5e9a12a1ce Mon Sep 17 00:00:00 2001 From: granawkins Date: Thu, 18 Apr 2024 15:12:28 +0700 Subject: [PATCH] fix context display --- mentat/code_context.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mentat/code_context.py b/mentat/code_context.py index 960e48f10..0cf65a6c5 100644 --- a/mentat/code_context.py +++ b/mentat/code_context.py @@ -191,11 +191,15 @@ async def get_code_message( auto_tokens=auto_tokens, ) for ref in context_builder.to_refs(): + new_features = list[CodeFeature]() # Save ragdaemon context back to include_files path, interval_str = split_intervals_from_path(Path(ref)) - intervals = parse_intervals(interval_str) - for interval in intervals: - feature = CodeFeature(cwd / path, interval) - self.include_features([feature]) # Save ragdaemon context back to include_files + if not interval_str: + new_features.append(CodeFeature(cwd / path)) + else: + intervals = parse_intervals(interval_str) + for interval in intervals: + new_features.append(CodeFeature(cwd / path, interval)) + self.include_features(new_features) # The context message is rendered by ragdaemon (ContextBuilder.render()) context_message = context_builder.render()