Skip to content

Add safe uploaded document clearing#17

Open
ar-amk wants to merge 1 commit into
aietal:masterfrom
ar-amk:codex/aimengpt-clear-rag-documents
Open

Add safe uploaded document clearing#17
ar-amk wants to merge 1 commit into
aietal:masterfrom
ar-amk:codex/aimengpt-clear-rag-documents

Conversation

@ar-amk
Copy link
Copy Markdown

@ar-amk ar-amk commented May 20, 2026

Part of the open Algora bounty for [ISAAC-497] Implement an enhanced RAG Pipeline for Scientific/Research Workflows.

/claim #45

Bounty reference: https://algora.io/isaac/bounties/clq18zr98000ejs0gt0nv7gwu

Summary

  • Add a sidebar action to clear uploaded RAG documents from the existing Chroma collection.
  • Make /api/delete-collection an explicit DELETE endpoint instead of allowing collection deletion through any request method.
  • Use CHROMA_PATH, matching the upload route's Docker-friendly Chroma default, instead of hardcoded localhost.
  • Return a structured JSON response and remove the unused embedding import.
  • Add focused route coverage for method guarding and configured Chroma deletion.

Why this helps the scientific RAG workflow

The app already lets users upload PDFs into the RAG collection, but there was no user-facing way to clear that uploaded document context. That makes document management brittle: stale research PDFs can continue influencing answers, and the only delete endpoint was unsafe and pointed at a different Chroma host than ingestion.

This PR keeps the scope small and reviewable: it improves document lifecycle control without overlapping the larger citation/chunking/reranking PRs already open.

Verification

From ui/:

npx vitest run __tests__/delete-collection.test.ts --reporter verbose
npx prettier --check pages/api/delete-collection.ts components/Chatbar/components/ChatbarSettings.tsx components/Chatbar/components/ClearUploadedDocuments.tsx __tests__/delete-collection.test.ts
npx tsc --noEmit --pretty false
npm run lint -- --file pages/api/delete-collection.ts --file components/Chatbar/components/ChatbarSettings.tsx --file components/Chatbar/components/ClearUploadedDocuments.tsx --file __tests__/delete-collection.test.ts
git diff --check

Results:

  • Targeted Vitest passed: 3 tests
  • Prettier passed
  • TypeScript passed
  • ESLint passed
  • Diff whitespace check passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant