mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-28 10:11:39 +00:00
API: Fix template switch endpoint
Forwards a Path instead of a string and adheres to the new pathfinding system. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -445,7 +445,8 @@ async def switch_template(data: TemplateSwitchRequest):
|
|||||||
raise HTTPException(400, error_message)
|
raise HTTPException(400, error_message)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
model.container.prompt_template = PromptTemplate.from_file(data.name)
|
template_path = pathlib.Path("templates") / data.name
|
||||||
|
model.container.prompt_template = PromptTemplate.from_file(template_path)
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
error_message = handle_request_error(
|
error_message = handle_request_error(
|
||||||
f"The template name {data.name} doesn't exist. Check the spelling?",
|
f"The template name {data.name} doesn't exist. Check the spelling?",
|
||||||
|
|||||||
Reference in New Issue
Block a user