mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 16:14:21 +00: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:
|
) -> Response:
|
||||||
user: KhojUser = request.user.object
|
user: KhojUser = request.user.object
|
||||||
|
|
||||||
is_safe_prompt, reason = await acheck_if_safe_prompt(body.persona)
|
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:
|
if not is_safe_prompt:
|
||||||
return Response(
|
return Response(
|
||||||
content=json.dumps({"error": f"{reason}"}),
|
content=json.dumps({"error": f"{reason}"}),
|
||||||
|
@ -217,7 +221,11 @@ async def update_agent(
|
||||||
) -> Response:
|
) -> Response:
|
||||||
user: KhojUser = request.user.object
|
user: KhojUser = request.user.object
|
||||||
|
|
||||||
is_safe_prompt, reason = await acheck_if_safe_prompt(body.persona)
|
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:
|
if not is_safe_prompt:
|
||||||
return Response(
|
return Response(
|
||||||
content=json.dumps({"error": f"{reason}"}),
|
content=json.dumps({"error": f"{reason}"}),
|
||||||
|
|
Loading…
Add table
Reference in a new issue