Skip to content

Commit c20d10b

Browse files
committed
Add detailed logging for new/updated/deleted pages
1 parent e44e633 commit c20d10b

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

src/doc_builder/build_embeddings.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,23 @@ def add_gradio_docs(
913913
print(f"New chunks to embed: {len(chunks_to_process)}")
914914
print(f"Stale entries to remove: {len(stale_ids)}")
915915

916+
# Log which pages are being updated
917+
if chunks_to_process:
918+
new_pages = {c.source_page_url for c in chunks_to_process}
919+
print(f"\nNew/updated pages ({len(new_pages)}):")
920+
for page in sorted(new_pages)[:20]: # Show first 20
921+
print(f" + {page}")
922+
if len(new_pages) > 20:
923+
print(f" ... and {len(new_pages) - 20} more")
924+
925+
# Log which IDs are being removed
926+
if stale_ids:
927+
print(f"\nStale IDs to remove ({len(stale_ids)}):")
928+
for stale_id in sorted(stale_ids)[:20]: # Show first 20
929+
print(f" - {stale_id}")
930+
if len(stale_ids) > 20:
931+
print(f" ... and {len(stale_ids) - 20} more")
932+
916933
if len(chunks_to_process) == 0 and len(stale_ids) == 0:
917934
print("No new Gradio documents to process. All documents are up to date.")
918935
return

src/doc_builder/commands/embeddings.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,23 @@ def process_hf_docs_command(args):
102102
print(f"New chunks to embed: {len(chunks_to_process)}")
103103
print(f"Stale entries to remove: {len(stale_ids)}")
104104

105+
# Log which pages are being updated
106+
if chunks_to_process:
107+
new_pages = {f"{c.package_name}/{c.page}" for c in chunks_to_process}
108+
print(f"\nNew/updated pages ({len(new_pages)}):")
109+
for page in sorted(new_pages)[:20]: # Show first 20
110+
print(f" + {page}")
111+
if len(new_pages) > 20:
112+
print(f" ... and {len(new_pages) - 20} more")
113+
114+
# Log which pages are being removed
115+
if stale_ids:
116+
print(f"\nStale IDs to remove ({len(stale_ids)}):")
117+
for stale_id in sorted(stale_ids)[:20]: # Show first 20
118+
print(f" - {stale_id}")
119+
if len(stale_ids) > 20:
120+
print(f" ... and {len(stale_ids) - 20} more")
121+
105122
if len(chunks_to_process) == 0 and len(stale_ids) == 0:
106123
print("\nNo new documents to process. All documents are up to date.")
107124
print("\n" + "=" * 80)

testdir/hub-docs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit c81752a5cfe74c1d0d09b9d11aeddbb582d80c3b

0 commit comments

Comments
 (0)