Skip to content

Commit 0b0dbe6

Browse files
committed
Merge branch 'pr/ELK-milu/314'
2 parents cee6a64 + 181341d commit 0b0dbe6

File tree

23 files changed

+1265
-223
lines changed

23 files changed

+1265
-223
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Read AGENTS.md
1+
See AGENTS.md

scripts/batch_upload.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@ def upload(
314314
directory: pathlib.Path = typer.Option(
315315
..., help="The directory containing files to upload.", exists=True, file_okay=False
316316
),
317-
pattern: list[str] = typer.Option(["*.md"], help="The glob patterns for files to upload (e.g., '*.pdf', '**/*.txt'). Can be specified multiple times."),
317+
pattern: list[str] = typer.Option(
318+
["*.md"],
319+
help="The glob patterns for files to upload (e.g., '*.pdf', '**/*.txt'). Can be specified multiple times.",
320+
),
318321
base_url: str = typer.Option("http://127.0.0.1:5050/api", help="The base URL of the API server."),
319322
username: str = typer.Option(..., help="Admin username for login."),
320323
password: str = typer.Option(..., help="Admin password for login."),
@@ -354,7 +357,9 @@ def upload(
354357

355358
if not all_files:
356359
patterns_str = "', '".join(pattern)
357-
console.print(f"[bold yellow]No files found in '{directory}' matching patterns: '{patterns_str}'. Aborting.[/bold yellow]")
360+
console.print(
361+
f"[bold yellow]No files found in '{directory}' matching patterns: '{patterns_str}'. Aborting.[/bold yellow]"
362+
)
358363
raise typer.Exit()
359364

360365
# 过滤掉macos的隐藏文件
@@ -398,11 +403,13 @@ async def run():
398403

399404
# Split all files into batches
400405
for batch_num in range(0, len(files_to_upload), batch_size):
401-
batch_files = files_to_upload[batch_num:batch_num + batch_size]
406+
batch_files = files_to_upload[batch_num : batch_num + batch_size]
402407
batch_start = batch_num + 1
403408
batch_end = min(batch_num + batch_size, len(files_to_upload))
404409

405-
console.print(f"\n[bold yellow]=== Batch {batch_start}-{batch_end} of {len(files_to_upload)} ===[/bold yellow]")
410+
console.print(
411+
f"\n[bold yellow]=== Batch {batch_start}-{batch_end} of {len(files_to_upload)} ===[/bold yellow]"
412+
)
406413

407414
# Step 1: Upload this batch of files sequentially
408415
console.print(f"[blue]Step 1: Uploading {len(batch_files)} files...[/blue]")
@@ -420,7 +427,9 @@ async def run():
420427
console=console,
421428
transient=True,
422429
) as progress:
423-
upload_task_id = progress.add_task(f"Uploading batch {batch_start}-{batch_end}...", total=len(batch_files), postfix="")
430+
upload_task_id = progress.add_task(
431+
f"Uploading batch {batch_start}-{batch_end}...", total=len(batch_files), postfix=""
432+
)
424433

425434
for file_path, file_hash in batch_files:
426435
server_file_path = await upload_single_file(
@@ -458,7 +467,9 @@ async def run():
458467

459468
# Step 3: Wait for this batch to complete
460469
if wait_for_completion and task_id:
461-
console.print(f"[cyan]Step 3: Waiting for batch {batch_start}-{batch_end} to complete...[/cyan]")
470+
console.print(
471+
f"[cyan]Step 3: Waiting for batch {batch_start}-{batch_end} to complete...[/cyan]"
472+
)
462473
await wait_for_tasks_completion(client, base_url, [task_id], poll_interval)
463474
console.print(f"[green]Batch {batch_start}-{batch_end} completed![/green]")
464475
else:

0 commit comments

Comments
 (0)