atlasbot: fix fallback fact parsing
This commit is contained in:
parent
a9d74a066f
commit
eb567fda06
@ -3829,9 +3829,12 @@ def _fallback_fact_answer(prompt: str, context: str) -> str:
|
|||||||
trimmed = line.strip()
|
trimmed = line.strip()
|
||||||
if not trimmed.startswith("F"):
|
if not trimmed.startswith("F"):
|
||||||
continue
|
continue
|
||||||
if ":" not in trimmed:
|
match = re.match(r"^F\\d+.*?\\]:\\s*(.*)$", trimmed)
|
||||||
|
if not match:
|
||||||
|
match = re.match(r"^F\\d+:\\s*(.*)$", trimmed)
|
||||||
|
if not match:
|
||||||
continue
|
continue
|
||||||
fact = trimmed.split(":", 1)[1].strip()
|
fact = match.group(1).strip()
|
||||||
if fact.startswith("-"):
|
if fact.startswith("-"):
|
||||||
fact = fact.lstrip("-").strip()
|
fact = fact.lstrip("-").strip()
|
||||||
if fact:
|
if fact:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user