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.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/continuedev/src/continuedev/steps/on_traceback.py b/continuedev/src/continuedev/steps/on_traceback.py
new file mode 100644
index 00000000..053b4ef4
--- /dev/null
+++ b/continuedev/src/continuedev/steps/on_traceback.py
@@ -0,0 +1,23 @@
+import os
+from ..core.main import Step
+from ..core.sdk import ContinueSDK
+from .chat import SimpleChatStep
+
+
+class DefaultOnTracebackStep(Step):
+ output: str
+ name: str = "Help With Traceback"
+ 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}"""))