Skip to content

Commit 2f32439

Browse files
aseembits93Codeflash Bot
authored andcommitted
bugfix
1 parent 067a200 commit 2f32439

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

codeflash/api/aiservice.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ def get_optimization_review(
559559
replay_tests: str,
560560
concolic_tests: str, # noqa: ARG002
561561
calling_fn_details: str,
562+
project_root_dir: Path,
562563
) -> str:
563564
"""Compute the optimization review of current Pull Request.
564565
@@ -574,6 +575,7 @@ def get_optimization_review(
574575
root_dir: Path -> path of git directory
575576
concolic_tests: str -> concolic_tests (not used)
576577
calling_fn_details: str -> filenames and definitions of functions which call the function_to_optimize
578+
project_root_dir: Path -> root dir of the project to calculate relative paths
577579
578580
Returns:
579581
-------
@@ -583,7 +585,10 @@ def get_optimization_review(
583585
diff_str = "\n".join(
584586
[
585587
unified_diff_strings(
586-
code1=original_code[p], code2=new_code[p], fromfile=Path(p).as_posix(), tofile=Path(p).as_posix()
588+
code1=original_code[p],
589+
code2=new_code[p],
590+
fromfile=Path(p).relative_to(project_root_dir).as_posix(),
591+
tofile=Path(p).relative_to(project_root_dir).as_posix(),
587592
)
588593
for p in original_code
589594
if not is_zero_diff(original_code[p], new_code[p])

codeflash/optimization/function_optimizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ def process_review(
15061506
# this will now run regardless of pr, staging review flags
15071507
try:
15081508
opt_review_response = self.aiservice_client.get_optimization_review(
1509-
**data, calling_fn_details=function_references
1509+
**data, calling_fn_details=function_references, project_root_dir=self.project_root
15101510
)
15111511
except Exception as e:
15121512
logger.debug(f"optimization review response failed, investigate {e}")

0 commit comments

Comments
 (0)