mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
More generic handling of GPT mangling of filenames
This commit is contained in:
parent
de2808f742
commit
52343b5340
2 changed files with 33 additions and 4 deletions
|
@ -66,10 +66,11 @@ class WholeFileCoder(Coder):
|
|||
# fname==None ... starting a new block
|
||||
if i > 0:
|
||||
fname = lines[i - 1].strip()
|
||||
path_to = "path/to/"
|
||||
# gpt-3.5 will sometimes crib /path/to from the one-shot example
|
||||
if fname.startswith(path_to) and fname not in chat_files:
|
||||
fname = fname[len(path_to) :]
|
||||
# Did gpt prepend a bogus dir? It especially likes to
|
||||
# include the path/to prefix from the one-shot example in
|
||||
# the prompt.
|
||||
if fname and fname not in chat_files and Path(fname).name in chat_files:
|
||||
fname = Path(fname).name
|
||||
if not fname: # blank line? or ``` was on first line i==0
|
||||
if saw_fname:
|
||||
fname = saw_fname
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue