Handle backtick-wrapped brackets in extraction result parsing

* Support `( and `( start patterns
* Support )` and )` end patterns
* Graceful fallback to warning logs
* Strip 2 chars for backtick variants
* Maintain existing bracket logic
This commit is contained in:
yangdx 2025-09-10 17:15:03 +08:00
parent 19014c6471
commit 00de0a4be8

View file

@ -881,15 +881,21 @@ async def _process_extraction_result(
if record.startswith("(") or record.startswith(""):
record = record[1:]
else:
logger.warning(
f"{chunk_key}: Record starting bracket can not be found in extraction result"
)
if record.startswith("`(") or record.startswith("`"):
record = record[2:]
else:
logger.warning(
f"{chunk_key}: Record starting bracket can not be found in extraction result"
)
if record.endswith(")") or record.endswith(""):
record = record[:-1]
else:
logger.warning(
f"{chunk_key}: Record ending bracket can not be found in extraction result"
)
if record.endswith(")`") or record.endswith("`"):
record = record[:-2]
else:
logger.warning(
f"{chunk_key}: Record ending bracket can not be found in extraction result"
)
record = record.strip()
if record is None: