fix: Handle ValueError when resolving relative path for uri (#585)

This commit is contained in:
you-n-g
2025-02-12 13:23:08 +08:00
committed by GitHub
parent 57c35cb2b9
commit 99141a7b19
+5 -1
View File
@@ -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")