mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-27 01:36:30 +02:00
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/. |
||
|---|---|---|
| .. | ||
| agent-tools-api.service.ts | ||
| anonymous-chat-api.service.ts | ||
| auth-api.service.ts | ||
| base-api.service.ts | ||
| chat-comments-api.service.ts | ||
| chat-threads-api.service.ts | ||
| connectors-api.service.ts | ||
| documents-api.service.ts | ||
| folders-api.service.ts | ||
| image-gen-config-api.service.ts | ||
| incentive-tasks-api.service.ts | ||
| invites-api.service.ts | ||
| logs-api.service.ts | ||
| members-api.service.ts | ||
| new-llm-config-api.service.ts | ||
| notes-api.service.ts | ||
| notifications-api.service.ts | ||
| permissions-api.service.ts | ||
| prompts-api.service.ts | ||
| public-chat-api.service.ts | ||
| roles-api.service.ts | ||
| search-spaces-api.service.ts | ||
| stripe-api.service.ts | ||
| user-api.service.ts | ||
| vision-llm-config-api.service.ts | ||