From 99141a7b191acf83941e856fa452f0de89e7ac6b Mon Sep 17 00:00:00 2001 From: you-n-g Date: Wed, 12 Feb 2025 13:23:08 +0800 Subject: [PATCH] fix: Handle ValueError when resolving relative path for uri (#585) --- rdagent/utils/agent/tpl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rdagent/utils/agent/tpl.py b/rdagent/utils/agent/tpl.py index 28345c34..6b44c57b 100644 --- a/rdagent/utils/agent/tpl.py +++ b/rdagent/utils/agent/tpl.py @@ -54,7 +54,11 @@ class RDAT: if path_part.startswith("."): yaml_file_path = caller_dir / f"{path_part[1:].replace('.', '/')}.yaml" - self.uri = f"{str(caller_dir.resolve().relative_to(PROJ_PATH)).replace('/', '.')}{uri}" + try: + # modify the uri to a raltive path to the project for easier finding prompts.yaml + self.uri = f"{str(caller_dir.resolve().relative_to(PROJ_PATH)).replace('/', '.')}{uri}" + except ValueError: + pass else: yaml_file_path = (PROJ_PATH / path_part.replace(".", "/")).with_suffix(".yaml")