diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 6a3e18670..988516b2c 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -270,6 +270,12 @@ class Coder: self.abs_fnames.add(self.abs_root_path(rel_fname)) self.check_added_files() + def drop_rel_fname(self, fname): + abs_fname = self.abs_root_path(fname) + if abs_fname in self.abs_fnames: + self.abs_fnames.remove(abs_fname) + return True + def abs_root_path(self, path): res = Path(self.root) / path return utils.safe_abs_path(res) diff --git a/aider/gui.py b/aider/gui.py index 409a28866..77c114ff4 100755 --- a/aider/gui.py +++ b/aider/gui.py @@ -184,8 +184,7 @@ class GUI: self.info(f"Added {fname} to the chat") for fname in self.coder.get_inchat_relative_files(): if fname not in fnames: - abs_fname = self.coder.abs_root_path(fname) - self.coder.abs_fnames.remove(abs_fname) + self.coder.drop_rel_fname(fname) self.info(f"Removed {fname} from the chat") with st.popover("Add web page"):