Skip to content

Commit

Permalink
Merge pull request #9 from 9bTFfT3qrJ/main
Browse files Browse the repository at this point in the history
fix a bug that caused backend_query to exit if it got malformed json …
  • Loading branch information
dulvui authored Aug 14, 2024
2 parents 16d1c48 + fdf585d commit 803a022
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rag/backend_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def log(msg: str):

connection_timeout = 2.0

claim = {}

while True:

try:
Expand All @@ -75,10 +77,14 @@ def log(msg: str):
time.sleep(1.0)
continue

try:
claim = json.loads(response.text)
except:
log("cannot parse JSON response from claim_job")
time.sleep(5.0)
continue
break

claim = json.loads(response.text)

conversation = json.loads(claim.get("conversation"))
conversation_llm = json.loads(claim.get("conversation_llm"))
source = json.loads(claim.get("source"))
Expand Down

0 comments on commit 803a022

Please sign in to comment.