feat: improve resume optimization and import reliability

This commit is contained in:
hyp
2026-08-10 11:26:47 +08:00
parent 1c762fd092
commit d8db0d8792
35 changed files with 1861 additions and 661 deletions
+11 -21
View File
@@ -79,31 +79,21 @@ def validate_proposal(proposal: dict[str, Any], facts: list[Any]) -> dict[str, A
def partition_entry_text(text: str, facts: list[Any]) -> tuple[str, list[str], list[str]]:
"""Strictly partition imported/RAG-expanded text from its source evidence.
"""Diagnose unsupported signatures without deleting a complete bullet.
Unlike a user-requested resume optimization proposal, imported content must
never silently turn a source fact into a different metric or deliverable.
Candidate text remains visible for user review. Removing an entire bullet because
one number or technical term needs confirmation previously discarded confirmed
facts in the same statement.
"""
ledger = normalize_fact_ledger(facts)
evidence = "\n".join(item["text"] for item in ledger)
confirmed: list[str] = []
suggestions: list[str] = []
for sentence in _SENTENCE.split(text.strip()):
clean = sentence.strip()
if not clean:
continue
if _has_unconfirmed_signature(clean, evidence):
suggestions.append(clean)
else:
confirmed.append(clean)
result = _rejoin_sentences(confirmed, had_line_breaks="\n" in text)
warnings: list[str] = []
if not result and suggestions:
result = _primary_description(ledger)
warnings.append("candidate_contains_unconfirmed_additions")
if suggestions:
warnings.append("suggestion_requires_confirmation")
return result, suggestions, warnings
suggestions = [
sentence.strip()
for sentence in _SENTENCE.split(text.strip())
if sentence.strip() and _has_unconfirmed_signature(sentence.strip(), evidence)
]
warnings = ["candidate_requires_confirmation"] if suggestions else []
return text.strip(), suggestions, warnings
def _rejoin_sentences(sentences: list[str], *, had_line_breaks: bool) -> str: