mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 21:29:12 +00:00
Only check the prompt safety if the agent is not private
This commit is contained in:
@@ -169,7 +169,11 @@ async def create_agent(
|
||||
) -> Response:
|
||||
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:
|
||||
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 = 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:
|
||||
return Response(
|
||||
content=json.dumps({"error": f"{reason}"}),
|
||||
|
||||
Reference in New Issue
Block a user