## Overview Adds **AI document classification** and a **classification-aware Files sidebar**: uploaded documents are automatically tagged with document-type labels (Invoice, Contract, Lab report, …), and the sidebar groups files under editable parent categories so a large library stays navigable. > [!IMPORTANT] > **This feature only runs in the SaaS build.** Classification depends on the AI engine and team-scoped label storage, so it's gated to SaaS end-to-end: > - The sidebar grouping is a `saas/`-layer override of the `fileSidebarGrouping` seam; every other build (OSS core, self-hosted proprietary, desktop) gets the null stub and renders the **unchanged flat, recency-sorted list** — no categories, no "Other", no picker. > - The classify/labels backend endpoints are gated on `policies.enabled` (on in SaaS) and live in `app/proprietary`, so they're absent from pure OSS and dormant in self-hosted unless explicitly enabled. > - The Python classifier is reached only via that gated path. > > Shared-layer changes that do compile everywhere are inert without the engine (dormant schema/field additions) or intentional (`GetInfoOnPDF` surfacing custom metadata). ## What it does - **Classifier (engine):** reads the first/last two pages of a PDF and assigns document-type labels from an allowed vocabulary. Labels are deliberately document-*type* descriptors — no deep-content/PII detection, since only a page window is read. - **Team label vocabulary:** ~270 built-in defaults across ~15 families, seeded per team. Editable by team leaders/admins in the Classification policy settings (import/export/reset). Team-scoped and shared; **per-user personal labels are intentionally out of scope** — the vocabulary is team-level only. - **Sidebar categories:** files group under parent categories (Financial, Legal, Medical, …), busiest-first, collapsible, with a "Recent" group on top and an "Other" group for anything uncategorised. The category structure (names, icons, membership, custom categories) is **device-local and user-editable** via a "Customize" picker — the only per-user personalization; it never changes the team's label vocabulary. - Classification results are written to PDF metadata (`StirlingPDFClassification`), read back to keep files in their groups without re-parsing. ## Architecture Spans all three layers, mirroring the existing policy/source subsystem conventions: - **`frontend/editor`** — sidebar grouping seam + SaaS override, category manager, labels editor, icon palette, file grouping, tests, `en-US` i18n. - **`app/proprietary` + `app/common` + `app/core`** — `ClassifyLabelController`, team-scoped `ClassificationLabelStore` (Jpa + in-process impls, same shape as `PolicyStore`/`SourceStore`), metadata read/write. - **`engine`** — the document-classifier agent, contracts, routes, tests. ## Screenshots **Files sidebar — grouped by category (SaaS)** ### Loading view <img width="2056" height="1046" alt="Screenshot 2026-07-07 at 5 12 56 PM" src="https://github.com/user-attachments/assets/1d712da5-50ae-4349-b0cd-e62665c3ec0c" /> ### Organized in the sidebar <img width="2056" height="1045" alt="Screenshot 2026-07-07 at 5 14 05 PM" src="https://github.com/user-attachments/assets/3ea4fe21-da51-4cea-bc3a-18ce040d3d05" /> **Customize categories picker** ### Personal settings to change how labels are grouped in an individual users editor <img width="2056" height="1044" alt="Screenshot 2026-07-07 at 5 52 42 PM" src="https://github.com/user-attachments/assets/40be03ce-0f63-4d1e-b58b-cec045d01cb2" /> **Classification labels editor (team settings)** <img width="2056" height="1042" alt="Screenshot 2026-07-07 at 5 53 00 PM" src="https://github.com/user-attachments/assets/337b0739-15c9-4749-9c6b-22e3b20825b8" /> ## Testing - Frontend `task frontend:check` — green (editor + portal tests, typecheck across all flavors, lint, label-drift guard). - Backend `task backend:check` (proprietary) and `:saas:test` — green. - Engine `task engine:check` — green.
184 lines
3.7 KiB
CSS
184 lines
3.7 KiB
CSS
/* Classification-labels editor: add box, chip grid, icon picker, and the
|
|
summary/modal chrome around them. */
|
|
|
|
.labels-editor {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--space-2);
|
|
min-height: 0;
|
|
}
|
|
|
|
/* ---- Add box ---- */
|
|
.labels-add {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-2);
|
|
}
|
|
.labels-add-input {
|
|
flex: 1;
|
|
min-width: 0;
|
|
padding: 0.4rem 0.6rem;
|
|
font-size: 0.8125rem;
|
|
font-family: inherit;
|
|
color: var(--color-text-1);
|
|
background: var(--color-surface);
|
|
border: 1px solid var(--border-default);
|
|
border-radius: var(--radius-md);
|
|
outline: none;
|
|
transition: border-color var(--motion-fast);
|
|
}
|
|
.labels-add-input:focus {
|
|
border-color: var(--color-blue);
|
|
}
|
|
.labels-add-error {
|
|
margin: 0;
|
|
font-size: 0.75rem;
|
|
color: var(--color-red);
|
|
}
|
|
.labels-empty {
|
|
margin: 0;
|
|
font-size: 0.8125rem;
|
|
color: var(--color-text-3);
|
|
}
|
|
|
|
/* ---- Chip grid (chips themselves are the shared @app/ui/LabelChip) ---- */
|
|
.labels-chips {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: var(--space-1_5);
|
|
overflow-y: auto;
|
|
min-height: 0;
|
|
}
|
|
|
|
/* ---- Icon picker (trigger + popover options) ---- */
|
|
.labels-icon-pick {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex: none;
|
|
width: 1.5rem;
|
|
height: 1.5rem;
|
|
border: none;
|
|
border-radius: var(--radius-md);
|
|
background: transparent;
|
|
color: var(--color-text-2);
|
|
cursor: pointer;
|
|
transition:
|
|
background var(--motion-fast),
|
|
color var(--motion-fast);
|
|
}
|
|
.labels-icon-pick:hover {
|
|
background: var(--color-bg-hover);
|
|
color: var(--color-text-1);
|
|
}
|
|
.labels-icon-option {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 2rem;
|
|
height: 2rem;
|
|
border: none;
|
|
background: transparent;
|
|
border-radius: var(--radius-md);
|
|
color: var(--color-text-2);
|
|
cursor: pointer;
|
|
transition:
|
|
background var(--motion-fast),
|
|
color var(--motion-fast);
|
|
}
|
|
.labels-icon-option:hover {
|
|
background: var(--color-bg-hover);
|
|
color: var(--color-text-1);
|
|
}
|
|
.labels-icon-option.is-selected {
|
|
background: var(--color-blue-light);
|
|
color: var(--color-blue);
|
|
}
|
|
|
|
/* ---- Section summary (Edit-Settings card) ---- */
|
|
.labels-summary {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--space-2);
|
|
}
|
|
.labels-summary-stats {
|
|
display: flex;
|
|
gap: var(--space-3);
|
|
font-size: 0.8125rem;
|
|
color: var(--color-text-2);
|
|
}
|
|
.labels-summary-note {
|
|
font-size: 0.75rem;
|
|
color: var(--color-text-3);
|
|
}
|
|
|
|
/* ---- Fat modal ---- */
|
|
.labels-modal {
|
|
width: min(1100px, 94vw);
|
|
max-width: min(1100px, 94vw);
|
|
}
|
|
.labels-modal-body {
|
|
max-height: min(70vh, 640px);
|
|
overflow-y: auto;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--space-3);
|
|
min-height: 0;
|
|
}
|
|
.labels-toolbar {
|
|
display: flex;
|
|
gap: var(--space-2);
|
|
}
|
|
.labels-footer {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: var(--space-2);
|
|
width: 100%;
|
|
}
|
|
.labels-footer-left,
|
|
.labels-footer-right {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-2);
|
|
}
|
|
|
|
/* ---- Grouped mode: chips under collapsible parent categories ---- */
|
|
.labels-groups {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--space-3);
|
|
}
|
|
.labels-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--space-2);
|
|
}
|
|
.labels-group-header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-2);
|
|
border: none;
|
|
background: transparent;
|
|
padding: 0;
|
|
cursor: pointer;
|
|
font-size: 0.85rem;
|
|
font-weight: 600;
|
|
color: var(--color-text-1, inherit);
|
|
}
|
|
.labels-group-name {
|
|
flex: 1;
|
|
text-align: left;
|
|
}
|
|
.labels-group-count {
|
|
font-size: 0.75rem;
|
|
font-weight: 500;
|
|
color: var(--color-text-3, rgba(128, 128, 128, 0.9));
|
|
}
|
|
.labels-group-ungrouped {
|
|
margin: 0;
|
|
font-size: 0.85rem;
|
|
font-weight: 600;
|
|
color: var(--color-text-2, inherit);
|
|
}
|