Skip to content

Dev#32

Open
stormyy00 wants to merge 7 commits into
mainfrom
dev
Open

Dev#32
stormyy00 wants to merge 7 commits into
mainfrom
dev

Conversation

@stormyy00
Copy link
Copy Markdown
Owner

@stormyy00 stormyy00 commented Feb 2, 2026

Summary by CodeRabbit

  • New Features

    • Global chat conversations with streaming replies, sidebar, and message threading.
    • Document thumbnails and thumbnail previews throughout the UI.
    • Inline document preview modal for quick viewing.
  • Improvements

    • Enhanced search UX and richer results display.
    • Refined trash workflow with detailed deletion/restore feedback.
    • Streamlined sign-in using a magic-link-first flow and added Chat dashboard tab.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
continote Ready Ready Preview, Comment Feb 2, 2026 3:23am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 2, 2026

Walkthrough

Adds a global, bin‑independent chat feature with SSE streaming and RAG search; implements thumbnail generation for images/PDFs and surfaces thumbnails in APIs and UI; expands trash cleanup with permanent deletion and failure tracking; and introduces multiple frontend UI components, hooks, and stores to support search, document preview, and chat.

Changes

Cohort / File(s) Summary
Package files
package.json, server/package.json
Added frontend deps (@tanstack/react-form, react-markdown, react-syntax-highlighter, @types/react-syntax-highlighter) and server deps for thumbnails/PDFs (canvas, pdfjs-dist, sharp).
Global Chat DB schema
server/src/db/schemas/global-conversations.ts, server/src/db/schemas/index.ts
New drizzle tables global_conversation and global_message with JSONB metadata/sources and exported types/relations.
Global Chat backend
server/src/global-chat/*.ts, server/src/routes/global-chat.router.ts, server/src/app.ts
New repository, service (SSE streaming, RAG vector search), controller, router; mounted at /api/global-chat; req auth enforced; app-level ETag disabled and API no-store headers added.
Vector search integration
server/src/langchain/vector-store.service.ts
Added user-scoped searchSimilarForUser that restricts vector search to a user's documents and optionally filters by document IDs.
Documents / Thumbnails
server/src/utils/thumbnails.ts, server/src/documents/*, server/src/db/schemas/documents.ts, server/src/types/models.ts
Thumbnail generation (images & PDFs → 300x300 WebP), store thumbnailPath, surface thumbnailUrl in API, generate/upload thumbnails on batch upload, include thumbnail cleanup on permanent delete.
Trash & cleanup
server/src/trash/*.ts, server/src/bins/*
New TrashRepository for listing deleted items; TrashService emptyTrash now tracks failures and returns detailed result; bins/documents permanent deletion validates trash state and performs storage + vector cleanup.
Middleware & utils
server/src/middleware/bin-ownership.middleware.ts, server/src/utils/auth.ts, server/src/utils/env.ts, server/src/app.ts
Normalized param handling for string
Controllers / typing fixes
server/src/chat/chat.controller.ts, server/src/documents/documents.controller.ts, server/src/trash/trash.controller.ts, server/src/bins/bins.controller.ts
Stricter param typing (IdParams), safer parsing of route params/arrays, adjusted error mappings, and removal of one explicit auth guard replaced by non-null assertion in bins controller.
Frontend global chat UI
src/components/global-chat/*, src/hooks/use-global-chat.ts, src/stores/global-chat-store.ts, src/types/global-chat.ts
New GlobalChat component, ConversationList, MessageBubble (Markdown + syntax highlighting), ChatInput, StatusIndicator; hooks for SSE streaming, optimistic updates, and a Zustand store for chat state and document filters.
Document preview & search UI
src/components/documents/document-preview-modal.tsx, src/components/search.tsx, src/hooks/use-document-search.ts, src/hooks/use-search.tsx
Document preview modal, reusable Search UI, search provider and hook, and auto-clearing search behavior.
Home / dashboard / layout
src/components/home/*, src/components/dash-layout.tsx, src/app/dashboard/*, src/app/layout.tsx, src/data/navigation.tsx
Tile-based home UI, new DashboardLayout with breadcrumbs, SearchProvider wrapping dashboard, Chat page and navigation Tab added.
UI components & tweaks
src/components/ui/*, src/components/chat/*, src/components/trash/*, src/components/sidebar/*
New breadcrumb primitives, xs button size, chat messages UI updates (file picker, expanded mode), async confirm dialog, trash toolbar alerts/messages, sidebar scrolling changes.
API client & util changes
src/utils/api-client.ts, src/utils/api.ts
Expanded trash.empty response shape (failedCount + failures), allowed PATCH method, added fetch cache: "no-store" for API and upload calls.
Hooks & stores updates
src/hooks/use-documents.ts, src/hooks/use-trash.ts, src/stores/ui-store.ts
Added document download URL hook and query keys, expanded invalidate keys on trash mutations, added UI store state for document preview.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Router as GlobalChatRouter
  participant Controller as GlobalChatController
  participant Service as GlobalChatService
  participant Vector as VectorStoreService
  participant Docs as DocumentsRepository
  participant Repo as GlobalChatRepository
  participant LLM as LLM

  Client->>Router: POST /api/global-chat/conversations/:id/messages (stream=true, message, documentIds?)
  Router->>Controller: forward request (requireAuth)
  Controller->>Service: sendMessageWithStreaming(conversationId, userId, message, res, documentIds)
  Service->>Repo: addMessage(user message)
  Service->>Docs: fetch user documents (for vector scope)
  Service->>Vector: searchSimilarForUser(query, userId, limit, filterDocumentIds)
  Vector->>Docs: enrich results with filename/fileType
  Vector-->>Service: returns search hits (sources)
  Service->>LLM: construct prompt + context, request streaming generation
  LLM-->>Service: stream tokens (delta events)
  Service->>Client: SSE events (status -> delta* -> done with messageId + sources)
  Service->>Repo: persist assistant message with metadata (sources, modelUsed)
  Service-->>Controller: finalize response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

"🐰
I hopped through code both day and night,
Thumbnails, chats, and trash set right.
Streams that murmur, search that gleams,
A cozy warren of new dreams.
Sniff the changes — a joyful byte!"


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

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