feat: report indexing progress with page counts in status panel
This commit is contained in:
1 parent
8f79993646
commit
b3f8019e01
7 files changed
+156
-13
No files matched your search
@@ -19,6 +19,9 @@ export interface Status {
|
||||
model: string;
|
||||
last_indexed_at: string | null;
|
||||
errors: string[];
|
||||
pages_processed: number;
|
||||
pages_total: number;
|
||||
current_file: string | null;
|
||||
}
|
||||
|
||||
export interface ChatMessage {
|
||||
|
||||
@@ -44,6 +44,33 @@ export function StatusPanel({ status, onReindex, reindexing }: StatusPanelProps)
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
{status?.state === "indexing" && (
|
||||
<div className="status__progress">
|
||||
<div className="status__progress-label">
|
||||
{status.current_file ? `Lendo ${status.current_file}` : "Lendo PDFs"}
|
||||
{status.pages_total > 0 && ` · ${status.pages_processed}/${status.pages_total} páginas`}
|
||||
</div>
|
||||
{status.pages_total > 0 && (
|
||||
<div
|
||||
className="status__progress-bar"
|
||||
role="progressbar"
|
||||
aria-valuenow={status.pages_processed}
|
||||
aria-valuemin={0}
|
||||
aria-valuemax={status.pages_total}
|
||||
>
|
||||
<span
|
||||
style={{
|
||||
width: `${Math.min(
|
||||
100,
|
||||
(status.pages_processed / status.pages_total) * 100,
|
||||
)}%`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{status && status.errors.length > 0 && (
|
||||
<ul className="status__errors">
|
||||
{status.errors.map((error) => (
|
||||
|
||||
@@ -212,6 +212,31 @@ body {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.status__progress {
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.status__progress-label {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.status__progress-bar {
|
||||
margin-top: 7px;
|
||||
height: 5px;
|
||||
border-radius: 999px;
|
||||
background: var(--bg);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.status__progress-bar > span {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-radius: 999px;
|
||||
background: var(--accent);
|
||||
transition: width 0.4s ease;
|
||||
}
|
||||
|
||||
.status__reindex {
|
||||
width: 100%;
|
||||
margin-top: 16px;
|
||||
|
||||
Reference in new issue
Block a user