Log each scan's processing time and add SHOW_SCAN_STATS
This commit is contained in:
1 parent
ad6cd4bbfd
commit
cb9a611aaa
9 files changed
+32
-3
No files matched your search
@@ -10,7 +10,7 @@ export interface Source {
|
||||
ignore_labels: string[]; applies_filter: string | null; prompt_notes: string | null;
|
||||
default_calendar_id: number | null; child_ids: number[];
|
||||
}
|
||||
export interface Household { timezone: string; children: Child[]; calendars: Calendar[]; sources: Source[] }
|
||||
export interface Household { timezone: string; show_scan_stats: boolean; children: Child[]; calendars: Calendar[]; sources: Source[] }
|
||||
|
||||
export interface CalEvent {
|
||||
id: number; uid: string; scan_id: number | null; source_id: number | null;
|
||||
@@ -32,7 +32,7 @@ export interface Scan {
|
||||
id: number; source_id: number; source_name: string; layout_type: Source['layout_type']; hint_month: string;
|
||||
date_start: string | null; date_end: string | null; image_keys: string[];
|
||||
status: 'queued' | 'parsed' | 'failed' | 'abandoned' | 'reviewed' | 'published';
|
||||
error: string | null; seconds: number | null; created_at: string; published_at: string | null;
|
||||
error: string | null; seconds: number | null; model: string | null; cost_tokens: number | null; created_at: string; published_at: string | null;
|
||||
events: CalEvent[]; menu_items: MenuItem[]; can_undo: boolean;
|
||||
}
|
||||
export interface ScanSummary {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import CalendarDays from '@lucide/svelte/icons/calendar-days';
|
||||
import ChevronDown from '@lucide/svelte/icons/chevron-down';
|
||||
import Cpu from '@lucide/svelte/icons/cpu';
|
||||
import CircleAlert from '@lucide/svelte/icons/circle-alert';
|
||||
import CircleCheck from '@lucide/svelte/icons/circle-check';
|
||||
import Download from '@lucide/svelte/icons/download';
|
||||
@@ -79,6 +80,13 @@
|
||||
<PageHeader title={scan.source_name} subtitle={monthLabel(scan.hint_month)} back="#/">
|
||||
{#snippet actions()}<StatusBadge status={scan!.status} />{/snippet}
|
||||
</PageHeader>
|
||||
{#if app.household!.show_scan_stats && scan.model && scan.seconds != null}
|
||||
<!-- SHOW_SCAN_STATS: for comparing models. -->
|
||||
<p class="hint stats tabular">
|
||||
<Cpu size={14} aria-hidden="true" />
|
||||
<span>Read by {scan.model} in {scan.seconds.toFixed(1)} s{scan.cost_tokens ? ` · ${scan.cost_tokens.toLocaleString()} tokens` : ''}</span>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
{#if scan.status === 'queued'}
|
||||
<section class="card state" aria-live="polite">
|
||||
@@ -173,5 +181,7 @@
|
||||
.photo-list img { display: block; width: 100%; height: auto; }
|
||||
.photos-gone { margin-top: var(--s4); text-align: center; }
|
||||
.menu-fix { margin-top: var(--s6); }
|
||||
.stats { display: flex; align-items: flex-start; gap: var(--s1); margin: calc(-1 * var(--s2)) 0 var(--s4); overflow-wrap: anywhere; }
|
||||
.stats :global(svg) { flex: none; margin-top: 3px; }
|
||||
.discard { margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid var(--border); display: flex; gap: var(--s2); }
|
||||
</style>
|
||||
Reference in new issue
Block a user