Documents #7

Open
opened 2026-10-23 03:32:08 -07:00 by westfarn · 0 comments
Owner

Part of #1.

Web route: /document_storage (protected).
Source: llm-fe/src/llm-fe/pages/DocumentStoragePage/DocumentStoragePage.tsx, utils/drive.ts.

Header shows Documents only when the subscription has RAG (hasRag).

Screenshot

Not attached. Route redirects to Sign in without a session. Capture both states after sign-in: the upgrade card (no RAG) and the document workspace (RAG).

Behavior

  • While subscription status is loading, show “Loading…”.
  • No RAG: card “Unlock document storage”. Copy says uploads and cloud drives need a plan with RAG document search. Button “Upgrade in Billing” goes to Account.
  • RAG: workspace.
    • Scope tabs company and personal when the user has a company. Users without a company stay on personal.
    • Table: name, uploaded date, active toggle, processed state. Page size 20. Search debounces 300ms and resets to page 1. Sort toggles created (default -created) and the other sort fields the table exposes.
    • Upload card: pick a file, then Upload.
    • Cloud drives (personal): connect Google Drive or OneDrive, pick folders, sync.
    • Company knowledge sources only for is_company_manager: shared Google Drive or Microsoft 365 site.
  • After OAuth returns with ?drive_connected=1, show “Drive connected. Choose folders below…” and strip the query param.

API

Call Purpose
GET /documents/ Query workspace (company|personal), page, page_size (20), search, ordering. Response { count, results[] } with id, file, created, active, processed.
POST /documents/ Multipart field file. Query workspace.
PATCH documents_details/{id} Body { active }. Optimistic toggle; revert on failure.
GET /drive/connections/ Connected drives.
GET /drive/connections/{id}/resources/ Folders/sites to select.
POST /drive/connections/{id}/sync/ Sync the selection into the knowledge base.
DELETE /drive/connections/{id}/ Disconnect.

Connect starts a browser OAuth redirect:

  • Personal: {API}/auth/oauth/{google|microsoft}/start/?intent=link_drive
  • Company: same path with intent=link_company_drive

Return path on web is /auth/callback/, then /document_storage/?drive_connected=1.

RAG entitlement comes from GET /monetization/subscription/ (same payload Account uses).

Android

New screen, linked from the header only when the plan includes RAG. Drive connect needs a Custom Tab and a return deep link.

Part of #1. Web route: `/document_storage` (protected). Source: `llm-fe/src/llm-fe/pages/DocumentStoragePage/DocumentStoragePage.tsx`, `utils/drive.ts`. Header shows **Documents** only when the subscription has RAG (`hasRag`). ## Screenshot Not attached. Route redirects to Sign in without a session. Capture both states after sign-in: the upgrade card (no RAG) and the document workspace (RAG). ## Behavior - While subscription status is loading, show “Loading…”. - No RAG: card “Unlock document storage”. Copy says uploads and cloud drives need a plan with RAG document search. Button “Upgrade in Billing” goes to Account. - RAG: workspace. - Scope tabs **company** and **personal** when the user has a company. Users without a company stay on personal. - Table: name, uploaded date, active toggle, processed state. Page size 20. Search debounces 300ms and resets to page 1. Sort toggles `created` (default `-created`) and the other sort fields the table exposes. - Upload card: pick a file, then Upload. - **Cloud drives** (personal): connect Google Drive or OneDrive, pick folders, sync. - **Company knowledge sources** only for `is_company_manager`: shared Google Drive or Microsoft 365 site. - After OAuth returns with `?drive_connected=1`, show “Drive connected. Choose folders below…” and strip the query param. ## API | Call | Purpose | | --- | --- | | `GET /documents/` | Query `workspace` (`company`\|`personal`), `page`, `page_size` (20), `search`, `ordering`. Response `{ count, results[] }` with `id`, `file`, `created`, `active`, `processed`. | | `POST /documents/` | Multipart field `file`. Query `workspace`. | | `PATCH documents_details/{id}` | Body `{ active }`. Optimistic toggle; revert on failure. | | `GET /drive/connections/` | Connected drives. | | `GET /drive/connections/{id}/resources/` | Folders/sites to select. | | `POST /drive/connections/{id}/sync/` | Sync the selection into the knowledge base. | | `DELETE /drive/connections/{id}/` | Disconnect. | Connect starts a browser OAuth redirect: - Personal: `{API}/auth/oauth/{google|microsoft}/start/?intent=link_drive` - Company: same path with `intent=link_company_drive` Return path on web is `/auth/callback/`, then `/document_storage/?drive_connected=1`. RAG entitlement comes from `GET /monetization/subscription/` (same payload Account uses). ## Android New screen, linked from the header only when the plan includes RAG. Drive connect needs a Custom Tab and a return deep link.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_android#7