mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 13:25:11 +00:00
After agent prompt safe check is parsed as json, load it into a json object
This commit is contained in:
@@ -325,7 +325,7 @@ async def acheck_if_safe_prompt(system_prompt: str, user: KhojUser = None, lax:
|
|||||||
|
|
||||||
response = response.strip()
|
response = response.strip()
|
||||||
try:
|
try:
|
||||||
response = clean_json(response)
|
response = json.loads(clean_json(response))
|
||||||
is_safe = response.get("safe", "True") == "True"
|
is_safe = response.get("safe", "True") == "True"
|
||||||
if not is_safe:
|
if not is_safe:
|
||||||
reason = response.get("reason", "")
|
reason = response.get("reason", "")
|
||||||
|
|||||||
Reference in New Issue
Block a user