Skip to content

Conversation

@vaishcodescape
Copy link

@vaishcodescape vaishcodescape commented Jan 13, 2026

Closes #227

📝 Description

This PR fixes the issue where the Weaviate client automatically connects and disconnects when the LLM gives a response. The previous implementation was creating a new connection and closing it on every request, which was inefficient and could cause performance issues

🔧 Changes Made

  • Implemented persistent Weaviate client connection management
  • Added _connected flag and ensure_connected() to reuse active connections
  • Updated get_weaviate_client() to avoid closing connections per request
  • Introduced close_weaviate_client() for graceful shutdown cleanup
  • Fixed logging to use lazy % formatting
  • Integrated Weaviate client cleanup into application lifespan (backend/main.py)

📷 Screenshots or Visual Changes (if applicable)

None

🤝 Collaboration

None

✅ Checklist

  • I have read the contributing guidelines.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if applicable).
  • Any dependent changes have been merged and published in downstream modules.

Summary by CodeRabbit

  • New Features

    • Added reusable Button component with multiple variant styles
    • Added social media links and scroll-to-top button to footer
  • Improvements

    • Redesigned Hero section with enhanced typography, cleaner layout, and improved styling
    • Refreshed Footer with animated layout and modern visual design
    • Enhanced Waitlist button with premium animations and visual effects
    • Expanded design system with new color tokens, typography scale, and interactive effects
  • Chores

    • Improved backend connection lifecycle management

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR addresses the Weaviate client connection lifecycle issue by implementing persistent connections with explicit startup/shutdown handling, introduces a reusable Button component with animation effects, and significantly enhances the landing page UI with modern animations, design tokens, and styling improvements.

Changes

Cohort / File(s) Summary
Weaviate Client Lifecycle
backend/app/database/weaviate/client.py
Added ensure_connected() for persistent connection reuse and close_weaviate_client() for graceful shutdown; updated get_weaviate_client() to use persistent connections instead of connect/close cycles (+32/-7)
FastAPI Application Lifecycle
backend/main.py
Integrated close_weaviate_client() into the FastAPI lifespan shutdown sequence to properly cleanup Weaviate connection on app shutdown (+2/-0)
Button Component
landing/src/components/ui/Button.tsx
New reusable component with primary/secondary variants, icon support, motion animations, shimmer effects, and support for both button and anchor modes (+132/-0)
Landing Page Components
landing/src/components/layout/Footer.tsx, landing/src/components/sections/Hero.tsx, landing/src/components/sections/Waitlist.tsx
Footer: major redesign with Framer Motion animations, social links, responsive grid layout, and scroll-to-top functionality (+143/-53). Hero: updated padding, typography sizing, decorative gradients, and Button component integration (+50/-28). Waitlist: enhanced button styling with animated gradient border, glow effects, and shimmer animations (+67/-28).
Landing Page Minor Updates
landing/src/components/layout/Navbar.tsx
Removed unused Github icon import (+1/-1)
Landing Page Styling & Design Tokens
landing/src/index.css, landing/tailwind.config.js
Comprehensive CSS redesign with design token system, typography scale, animation utilities, and elevation tokens (+335/-17). Tailwind config expanded with color scales, shadows, spacing, and animation definitions (+59/-1).
Landing Page Dependencies
landing/package.json
Added Emotion React/Styled and Material-UI dependencies for styling infrastructure (+3/-0)

Sequence Diagrams

sequenceDiagram
    actor FastAPI
    participant WeaviateClient as Weaviate Client Module
    participant WeaviateService as Weaviate Service
    
    rect rgb(200, 150, 255)
    Note over FastAPI,WeaviateService: Old Behavior (Per Request)
    FastAPI->>WeaviateClient: get_weaviate_client()
    WeaviateClient->>WeaviateService: connect()
    WeaviateClient->>FastAPI: yield client
    FastAPI->>WeaviateService: query/operation
    WeaviateService-->>FastAPI: result
    FastAPI->>WeaviateClient: exit context
    WeaviateClient->>WeaviateService: close()
    Note over FastAPI,WeaviateService: ⚠️ Repeated per request = latency
    end
    
    rect rgb(150, 200, 150)
    Note over FastAPI,WeaviateService: New Behavior (Persistent)
    FastAPI->>WeaviateClient: ensure_connected()
    alt Connection exists
        WeaviateClient-->>FastAPI: reuse existing
    else First connection
        WeaviateClient->>WeaviateService: connect() [once]
        WeaviateService-->>WeaviateClient: connected
    end
    FastAPI->>WeaviateService: query/operation
    WeaviateService-->>FastAPI: result
    Note over FastAPI,WeaviateService: ✓ Connection reused across requests
    FastAPI->>WeaviateClient: close_weaviate_client() [on shutdown]
    WeaviateClient->>WeaviateService: close() [once]
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Suggested reviewers

  • chandansgowda
  • smokeyScraper

Poem

🐰 A rabbit's ode to persistence and style

Once connections danced away with each request's call,
Now they stay and play—no disconnect at all!
With buttons that shimmer and footers that glide,
The landing page blooms with animated pride! 🌟✨

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa66519 and 8fe16ea.

⛔ Files ignored due to path filters (2)
  • landing/package-lock.json is excluded by !**/package-lock.json
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • backend/app/database/weaviate/client.py
  • backend/main.py
  • landing/package.json
  • landing/src/components/layout/Footer.tsx
  • landing/src/components/layout/Navbar.tsx
  • landing/src/components/sections/Hero.tsx
  • landing/src/components/sections/Waitlist.tsx
  • landing/src/components/ui/Button.tsx
  • landing/src/index.css
  • landing/tailwind.config.js

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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.

BUG:Weaviate client connects and disconnects causing latency issues

1 participant