Commit d029ae58 authored by Jan Reimes's avatar Jan Reimes
Browse files

Fix: Update progress bar to show processed count and remaining items

The progress bar was only updating description but not advancing the
progress bar percentage. It also wasn't showing how many documents
had been processed or remaining.

Fixed by:
1. Adding processed_count = [0] to track documents processed
2. Incrementing count in progress_callback after each document completes
3. Using advance=1 parameter to update progress bar incrementally
4. Updating description to show 'X/Y processed' and 'N remaining' format
5. Removing final progress.update() call since we update incrementally

Now progress bar shows:
- Processed count (e.g., '3/10')
- Current document being processed
- Number of remaining documents
- Pipeline stage
- Visual progress bar that advances with each document

Matches style of 'ai workspace list-members' table output.
parent 555d69b2
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -552,6 +552,9 @@ def workspace_process(
        console=console,
        refresh_per_second=10,
    ) as progress:
        # Track processed count for progress updates
        processed_count = [0]  # Use list to allow modification in callback

        # Create main task
        task = progress.add_task(
            f"[cyan]Processing workspace '{normalize_workspace_name(workspace)}'[/cyan]",
@@ -562,7 +565,13 @@ def workspace_process(
        def progress_callback(stage: PipelineStage, doc_id: str) -> None:
            # Update description with current document and stage
            stage_name = stage.value.replace("_", " ").title()
            progress.update(task, description=f"[cyan]Processing {doc_id}[/cyan] [dim]- {stage_name}[/dim]")
            processed_count[0] += 1
            remaining = len(document_ids) - processed_count[0]
            progress.update(
                task,
                advance=1,
                description=f"[cyan]{processed_count[0]}/{len(document_ids)}[/cyan] [cyan]Processing {doc_id}[/cyan] [dim]{remaining} remaining[/dim] [dim]- {stage_name}[/dim]",
            )

        # Process documents with progress tracking
        results = process_all(
@@ -574,9 +583,6 @@ def workspace_process(
            progress_callback=progress_callback,
        )

        # Update progress to completed
        progress.update(task, completed=len(document_ids))

    if json_output:
        typer.echo(
            json.dumps(