fix callback function error (#2096)

### What problem does this PR solve?

#2085

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu 2024-08-26 14:12:52 +08:00 committed by GitHub
parent e9202999cb
commit c3e344b0f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,7 +131,7 @@ class GraphExtractor:
total_token_count += token_count
if callback: callback(msg=f"{doc_index+1}/{total}, elapsed: {timer() - st}s, used tokens: {total_token_count}")
except Exception as e:
if callback: callback("Knowledge graph extraction error:{}".format(str(e)))
if callback: callback(msg="Knowledge graph extraction error:{}".format(str(e)))
logging.exception("error extracting graph")
self._on_error(
e,