Skip to content

Commit cf38295

Browse files
committed
fix: update existing concept briefs in index.md instead of skipping
1 parent 2b7394f commit cf38295

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

openkb/agent/compiler.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,18 @@ def _update_index(
494494

495495
for name in concept_names:
496496
concept_link = f"[[concepts/{name}]]"
497-
if concept_link not in text:
498-
concept_entry = f"- {concept_link}"
497+
concept_entry = f"- {concept_link}"
498+
if name in concept_briefs:
499+
concept_entry += f" — {concept_briefs[name]}"
500+
if concept_link in text:
499501
if name in concept_briefs:
500-
concept_entry += f" — {concept_briefs[name]}"
502+
lines = text.split("\n")
503+
for i, line in enumerate(lines):
504+
if concept_link in line:
505+
lines[i] = concept_entry
506+
break
507+
text = "\n".join(lines)
508+
else:
501509
if "## Concepts" in text:
502510
text = text.replace("## Concepts\n", f"## Concepts\n{concept_entry}\n", 1)
503511

0 commit comments

Comments
 (0)