summaryrefslogtreecommitdiff
path: root/continuedev/src/continuedev/steps/on_traceback.py
diff options
context:
space:
mode:
Diffstat (limited to 'continuedev/src/continuedev/steps/on_traceback.py')
-rw-r--r--continuedev/src/continuedev/steps/on_traceback.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/continuedev/src/continuedev/steps/on_traceback.py b/continuedev/src/continuedev/steps/on_traceback.py
index a0c4d07b..053b4ef4 100644
--- a/continuedev/src/continuedev/steps/on_traceback.py
+++ b/continuedev/src/continuedev/steps/on_traceback.py
@@ -1,3 +1,4 @@
+import os
from ..core.main import Step
from ..core.sdk import ContinueSDK
from .chat import SimpleChatStep
@@ -9,6 +10,14 @@ class DefaultOnTracebackStep(Step):
hide: bool = True
async def run(self, sdk: ContinueSDK):
+ # Add context for any files in the traceback that are in the workspace
+ for line in self.output.split("\n"):
+ segs = line.split(" ")
+ for seg in segs:
+ if seg.startswith(os.path.sep) and os.path.exists(seg) and os.path.commonprefix([seg, sdk.ide.workspace_directory]) == sdk.ide.workspace_directory:
+ file_contents = await sdk.ide.readFile(seg)
+ await sdk.add_chat_context(f"The contents of {seg}:\n```\n{file_contents}\n```", "", "user")
+
await sdk.run_step(SimpleChatStep(
name="Help With Traceback",
user_input=f"""I got the following error, can you please help explain how to fix it?\n\n{self.output}"""))