From 594f7ceb5cd32cb570ef54ec0addda3563ca435c Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Mon, 17 Jul 2023 10:19:54 -0500 Subject: use difflib to give edit change description --- continuedev/src/continuedev/steps/core/core.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'continuedev/src') diff --git a/continuedev/src/continuedev/steps/core/core.py b/continuedev/src/continuedev/steps/core/core.py index d5a7cd9a..41988000 100644 --- a/continuedev/src/continuedev/steps/core/core.py +++ b/continuedev/src/continuedev/steps/core/core.py @@ -1,6 +1,7 @@ # These steps are depended upon by ContinueSDK import os import subprocess +import difflib from textwrap import dedent from typing import Coroutine, List, Literal, Union @@ -172,13 +173,12 @@ class DefaultModelEditCodeStep(Step): if self._previous_contents.strip() == self._new_contents.strip(): description = "No edits were made" else: + changes = '\n'.join(difflib.ndiff(self._previous_contents.splitlines(), self._new_contents.splitlines())) description = await models.gpt3516k.complete(dedent(f"""\ - ```original - {self._previous_contents} - ``` + Diff summary: "{self.user_input}" - ```new - {self._new_contents} + ```diff + {changes} ``` Please give brief a description of the changes made above using markdown bullet points. Be concise:""")) -- cgit v1.2.3-70-g09d2