Skip to content

Commit 13107fe

Browse files
committed
Fix for #901 - check for c: path existence before plugins
1 parent 0950ff3 commit 13107fe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llm/cli.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,7 +3207,9 @@ def load_template(name: str) -> Template:
32073207
raise LoadTemplateError("Could not load template {}: {}".format(name, ex))
32083208
return _parse_yaml_template(name, response.text)
32093209

3210-
if has_plugin_prefix(name):
3210+
potential_path = pathlib.Path(name)
3211+
3212+
if has_plugin_prefix(name) and not potential_path.exists():
32113213
prefix, rest = name.split(":", 1)
32123214
loaders = get_template_loaders()
32133215
if prefix not in loaders:
@@ -3218,12 +3220,11 @@ def load_template(name: str) -> Template:
32183220
except Exception as ex:
32193221
raise LoadTemplateError("Could not load template {}: {}".format(name, ex))
32203222

3221-
# First try local file
3222-
potential_path = pathlib.Path(name)
3223+
# Try local file
32233224
if potential_path.exists():
32243225
path = potential_path
32253226
else:
3226-
# Look for in template_dir()
3227+
# Look for template in template_dir()
32273228
path = template_dir() / f"{name}.yaml"
32283229
if not path.exists():
32293230
raise LoadTemplateError(f"Invalid template: {name}")

0 commit comments

Comments
 (0)