Skip to content

Commit

Permalink
add handling to endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Jan 5, 2025
1 parent 77a1847 commit 661dc59
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions agixt/endpoints/Prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,12 @@ async def update_prompt(
async def get_prompt_arg(
prompt_name: str, prompt_category: str = "Default", user=Depends(verify_api_key)
):
prompt_name = prompt_name.replace("%20", " ")
prompt_category = prompt_category.replace("%20", " ")
prompt = Prompts(user=user).get_prompt(
prompt_name=prompt_name, prompt_category=prompt_category
)
return {"prompt_args": Prompts(user=user).get_prompt_args(prompt)}
try:
prompt_name = prompt_name.replace("%20", " ")
prompt_category = prompt_category.replace("%20", " ")
prompt = Prompts(user=user).get_prompt(
prompt_name=prompt_name, prompt_category=prompt_category
)
return {"prompt_args": Prompts(user=user).get_prompt_args(prompt)}
except Exception as e:
raise HTTPException(status_code=404, detail=f"Prompt not found.")

0 comments on commit 661dc59

Please sign in to comment.