diff options
| author | Nate Sesti <sestinj@gmail.com> | 2023-07-04 13:43:09 -0700 | 
|---|---|---|
| committer | Nate Sesti <sestinj@gmail.com> | 2023-07-04 13:43:09 -0700 | 
| commit | 67e70b868f63e20c2b0cae875993e267a5c32d5e (patch) | |
| tree | 9a2d3f32029010d4c4f6a486aa1d9c508ee4bc1a /continuedev/src | |
| parent | 6d535c02e50bcf0ff80b5c615e4afb01bb36b631 (diff) | |
| download | sncontinue-67e70b868f63e20c2b0cae875993e267a5c32d5e.tar.gz sncontinue-67e70b868f63e20c2b0cae875993e267a5c32d5e.tar.bz2 sncontinue-67e70b868f63e20c2b0cae875993e267a5c32d5e.zip | |
many fixes
Diffstat (limited to 'continuedev/src')
| -rw-r--r-- | continuedev/src/continuedev/core/autopilot.py | 11 | ||||
| -rw-r--r-- | continuedev/src/continuedev/core/main.py | 7 | ||||
| -rw-r--r-- | continuedev/src/continuedev/core/sdk.py | 13 | ||||
| -rw-r--r-- | continuedev/src/continuedev/steps/chat.py | 1 | 
4 files changed, 24 insertions, 8 deletions
| diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py index 05e48f40..313ceded 100644 --- a/continuedev/src/continuedev/core/autopilot.py +++ b/continuedev/src/continuedev/core/autopilot.py @@ -144,9 +144,7 @@ class Autopilot(ContinueBaseModel):      async def handle_highlighted_code(self, range_in_files: List[RangeInFileWithContents]):          workspace_path = self.continue_sdk.ide.workspace_directory          for rif in range_in_files: -            rif.filepath = os.path.relpath(rif.filepath, workspace_path) -            if rif.filepath.startswith(".."): -                rif.filepath = os.path.basename(rif.filepath) +            rif.filepath = os.path.basename(rif.filepath)          # If current range overlaps with any others, delete them and only keep the new range          new_ranges = [] @@ -156,6 +154,13 @@ class Autopilot(ContinueBaseModel):                  if rif.filepath == new_rif.filepath and rif.range.overlaps_with(new_rif.range):                      found_overlap = True                      break + +                # Also don't allow multiple ranges in same file with same content. This is useless to the model, and avoids +                # the bug where cmd+f causes repeated highlights +                if rif.filepath == new_rif.filepath and rif.contents == new_rif.contents: +                    found_overlap = True +                    break +              if not found_overlap:                  new_ranges.append(rif) diff --git a/continuedev/src/continuedev/core/main.py b/continuedev/src/continuedev/core/main.py index 9a6617f4..8bad09d1 100644 --- a/continuedev/src/continuedev/core/main.py +++ b/continuedev/src/continuedev/core/main.py @@ -107,11 +107,9 @@ class HistoryNode(ContinueBaseModel):              return self.step.chat_context          return self.step.chat_context + [              ChatMessage( -                role="function", +                role="assistant",                  name=self.step.__class__.__name__, -                content=json.dumps({ -                    "description": self.step.description or "Function complete", -                }), +                content=self.step.description or f"Ran function {self.step.name}",                  summary=f"Called function {self.step.name}"              )] @@ -200,6 +198,7 @@ class SlashCommandDescription(ContinueBaseModel):      name: str      description: str +  class FullState(ContinueBaseModel):      """A full state of the program, including the history"""      history: History diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py index 988ac6b0..fe975b99 100644 --- a/continuedev/src/continuedev/core/sdk.py +++ b/continuedev/src/continuedev/core/sdk.py @@ -97,7 +97,18 @@ class ContinueSDK(AbstractContinueSDK):      async def _ensure_absolute_path(self, path: str) -> str:          if os.path.isabs(path):              return path -        return os.path.join(self.ide.workspace_directory, path) + +        # Else if in workspace +        workspace_path = os.path.join(self.ide.workspace_directory, path) +        if os.path.exists(workspace_path): +            return workspace_path +        else: +            # Check if it matches any of the open files, then use that absolute path +            open_files = await self.ide.getOpenFiles() +            for open_file in open_files: +                if os.path.basename(open_file) == os.path.basename(path): +                    return open_file +            raise Exception(f"Path {path} does not exist")      async def run_step(self, step: Step) -> Coroutine[Observation, None, None]:          return await self.__autopilot._run_singular_step(step) diff --git a/continuedev/src/continuedev/steps/chat.py b/continuedev/src/continuedev/steps/chat.py index 49dd98e4..db3f9d7f 100644 --- a/continuedev/src/continuedev/steps/chat.py +++ b/continuedev/src/continuedev/steps/chat.py @@ -149,6 +149,7 @@ class ChatWithFunctions(Step):      name: str = "Input"      manage_own_chat_context: bool = True      description: str = "" +    hide: bool = True      async def run(self, sdk: ContinueSDK):          await sdk.update_ui() | 
