Update Coder class to use absolute file names instead of relative file names

This commit is contained in:
Paul Gauthier 2024-07-29 17:31:54 -03:00 committed by Paul Gauthier (aider)
parent 122eb8834a
commit 384a5f2ea5

View file

@ -2,6 +2,7 @@
import hashlib import hashlib
import json import json
import math
import mimetypes import mimetypes
import os import os
import platform import platform
@ -11,7 +12,6 @@ import threading
import time import time
import traceback import traceback
from collections import defaultdict from collections import defaultdict
import math
from datetime import datetime from datetime import datetime
from json.decoder import JSONDecodeError from json.decoder import JSONDecodeError
from pathlib import Path from pathlib import Path
@ -113,7 +113,7 @@ class Coder:
# Bring along context from the old Coder # Bring along context from the old Coder
update = dict( update = dict(
fnames=from_coder.get_inchat_relative_files(), fnames=list(from_coder.abs_fnames),
done_messages=done_messages, done_messages=done_messages,
cur_messages=from_coder.cur_messages, cur_messages=from_coder.cur_messages,
aider_commit_hashes=from_coder.aider_commit_hashes, aider_commit_hashes=from_coder.aider_commit_hashes,
@ -1274,7 +1274,9 @@ class Coder:
else: else:
return f"{value:.{max(2, 2 - int(math.log10(magnitude)))}f}" return f"{value:.{max(2, 2 - int(math.log10(magnitude)))}f}"
self.usage_report += f" Cost: ${format_cost(cost)} request, ${format_cost(self.total_cost)} session." self.usage_report += (
f" Cost: ${format_cost(cost)} request, ${format_cost(self.total_cost)} session."
)
def get_multi_response_content(self, final=False): def get_multi_response_content(self, final=False):
cur = self.multi_response_content cur = self.multi_response_content