mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Only check the prompt safety if the agent is not private
This commit is contained in:
parent
f700d5bddb
commit
e10a0571ff
1 changed files with 10 additions and 2 deletions
|
@ -169,7 +169,11 @@ async def create_agent(
|
|||
) -> Response:
|
||||
user: KhojUser = request.user.object
|
||||
|
||||
is_safe_prompt, reason = True, ""
|
||||
|
||||
if body.privacy_level != Agent.PrivacyLevel.PRIVATE:
|
||||
is_safe_prompt, reason = await acheck_if_safe_prompt(body.persona)
|
||||
|
||||
if not is_safe_prompt:
|
||||
return Response(
|
||||
content=json.dumps({"error": f"{reason}"}),
|
||||
|
@ -217,7 +221,11 @@ async def update_agent(
|
|||
) -> Response:
|
||||
user: KhojUser = request.user.object
|
||||
|
||||
is_safe_prompt, reason = True, ""
|
||||
|
||||
if body.privacy_level != Agent.PrivacyLevel.PRIVATE:
|
||||
is_safe_prompt, reason = await acheck_if_safe_prompt(body.persona)
|
||||
|
||||
if not is_safe_prompt:
|
||||
return Response(
|
||||
content=json.dumps({"error": f"{reason}"}),
|
||||
|
|
Loading…
Reference in a new issue