SurfSense/surfsense_web/components
Trevin Chow a2ddf47650 refactor(anon-chat): route upload through anonymousChatApiService
Fixes #1245. Deduplicate the anonymous-chat file upload request, which
was inlined verbatim in DocumentsSidebar.tsx and free-composer.tsx
while anonymousChatApiService.uploadDocument already existed.

Key change: service now returns a discriminated result instead of
throwing on 409. Callers need to distinguish 409 (quota exceeded, ->
gate to login) from other non-OK responses (real errors, -> throw).

  export type AnonUploadResult =
    | { ok: true; data: { filename: string; size_bytes: number } }
    | { ok: false; reason: "quota_exceeded" };

Both call sites now do:

  const result = await anonymousChatApiService.uploadDocument(file);
  if (!result.ok) {
    if (result.reason === "quota_exceeded") gate("upload more documents");
    return;
  }
  const data = result.data;

Dropped the BACKEND_URL import in both files (no longer used). Verified
zero remaining /api/v1/public/anon-chat/upload references in
surfsense_web/.
2026-04-23 03:26:42 -07:00
..
announcements feat: no login experience and prem tokens 2026-04-15 17:02:00 -07:00
assistant-ui fix: treat all Gmail/Calendar as live connectors, hide indexing UI 2026-04-22 22:51:28 +02:00
auth chore: linting 2026-03-27 03:17:05 -07:00
chat-comments feat: add processing mode support for document uploads and ETL pipeline, improded error handling ux 2026-04-14 21:26:00 -07:00
connectors feat: enhance OneDrive folder management by adding mimeType handling and integrating DriveFolderTree component for improved UI 2026-03-29 03:29:31 +05:30
contact feat: add processing mode support for document uploads and ETL pipeline, improded error handling ux 2026-04-14 21:26:00 -07:00
desktop Formatting 2026-04-07 20:28:07 +02:00
documents fix(dialogs): move open-reset effects into onOpenChange handlers 2026-04-19 16:09:34 +05:30
editor feat: add processing mode support for document uploads and ETL pipeline, improded error handling ux 2026-04-14 21:26:00 -07:00
editor-panel Merge remote-tracking branch 'upstream/dev' into feat/unified-etl-pipeline 2026-04-06 22:04:51 +05:30
free-chat refactor(anon-chat): route upload through anonymousChatApiService 2026-04-23 03:26:42 -07:00
hitl-edit-panel fix(hitl-edit-panel): move duplicate-tag check into functional setTags 2026-04-21 01:43:20 -07:00
homepage chore: linting 2026-04-22 01:05:31 -07:00
icons/providers feat: enhance model selector UI abd added github models icon 2026-04-14 20:35:16 +05:30
layout refactor(anon-chat): route upload through anonymousChatApiService 2026-04-23 03:26:42 -07:00
new-chat Merge pull request #1275 from Tacite243/fix/move-modelSelector-reset-effects-into-the-openTab-event-handlers-1252 2026-04-20 21:01:42 -07:00
pricing cloud: added openrouter integration with global configs 2026-04-15 23:46:29 -07:00
prompt-kit refactor: improve write_todos tool and UI components 2025-12-26 17:49:56 +05:30
providers feat: no login experience and prem tokens 2026-04-15 17:02:00 -07:00
public-chat refactor: update UI components for improved layout in assistant message, public chat footer, and report panel 2026-04-17 09:03:34 +05:30
public-chat-snapshots feat: add processing mode support for document uploads and ETL pipeline, improded error handling ux 2026-04-14 21:26:00 -07:00
report-panel chore: ran linting 2026-04-17 16:45:14 +05:30
seo feat: add processing mode support for document uploads and ETL pipeline, improded error handling ux 2026-04-14 21:26:00 -07:00
settings feat: add maxLength constraints to auth and settings form inputs 2026-04-16 22:33:01 +08:00
shared feat: implement PDF viewer for resume previews and integrate with report panel 2026-04-15 21:42:50 +05:30
sources chore: linting 2026-04-22 01:05:31 -07:00
theme fix(theme-toggle): use functional setIsDark in toggleTheme (#1247) 2026-04-20 01:58:20 -07:00
tool-ui feat: implement resume page limit functionality 2026-04-22 18:46:17 +05:30
ui refactor: simplify alert descriptions, improved icons, improved UI in LLM settings 2026-04-10 19:07:35 +05:30
container.tsx feat: enhance SurfSense with new skills, blog section, and improve SEO metadata 2026-04-11 23:38:12 -07:00
document-viewer.tsx Biome: fixes for compontents directory 2025-07-27 10:41:15 -07:00
inference-params-editor.tsx feat: integrate document upload dialog in ComposerAction and update sidebar components for improved user interaction and styling consistency 2026-03-07 03:29:46 +05:30
json-metadata-viewer.tsx chore: linting 2026-02-09 16:49:11 -08:00
LanguageSwitcher.tsx feat: add support for additional languages in LanguageSwitcher and SidebarUserProfile components 2026-02-11 00:39:01 -08:00
Logo.tsx feat: enhance SurfSense with new skills, blog section, and improve SEO metadata 2026-04-11 23:38:12 -07:00
markdown-viewer.tsx refactor: remove unused drizzle-orm import from markdown-viewer 2026-04-08 06:36:50 +05:30
onboarding-tour.tsx perf: add passive option to scroll and touch event listeners 2026-04-04 22:03:06 -07:00
platform-gate.tsx feat: enhance keyboard shortcut management and improve app responsiveness 2026-04-07 00:43:40 -07:00
pricing.tsx feat: enhance SurfSense with new skills, blog section, and improve SEO metadata 2026-04-11 23:38:12 -07:00
search-space-form.tsx ui: adjust dashboard search spaces heading text and padding responsiveness 2026-01-03 01:09:33 +07:00
TokenHandler.tsx Formatting 2026-04-07 20:28:07 +02:00
UserDropdown.tsx fix: replace window.location with router.push for client-side navigation 2026-04-08 00:01:30 -07:00