BOT
theunpartybot
Status: Active Development
Primary Purpose: AI-powered conversational bot with real-time messaging, semantic search, and intelligent document processing
Overview
theunpartybot is an interactive AI chatbot platform built to provide real-time conversational experiences with advanced capabilities including semantic search via Pinecone, OpenAI integration, and document processing. The bot serves as an intelligent interface for the UNPARTY ecosystem, enabling users to interact with AI, search embedded content, and upload documents for processing.
Tech Stack
- Framework: Next.js 14 (Pages Router + App Router hybrid)
- Language: TypeScript
- Runtime: Node.js with ts-node
- Real-Time Communication: Socket.io
- AI Integration: OpenAI API (GPT-3.5-turbo), AI SDK by Vercel
- Vector Database: Pinecone (semantic search and embeddings)
- Cloud Storage: AWS S3 (document storage with presigned URLs)
- Styling: Tailwind CSS
- Deployment: Vercel-ready
Key Features
1. Real-Time Chat Interface
- Socket.io Integration: Bidirectional real-time messaging between client and server
- Message History: Persistent message storage with timestamps and sender identification
- Interactive UI: Custom chat components with dynamic styling and button support
2. AI-Powered Conversations
- OpenAI Integration: Streaming chat completions using GPT-3.5-turbo
- AI SDK by Vercel: Modern React hooks (
useChat) for seamless AI interactions - Context-Aware Responses: System prompts configured for helpful, knowledgeable assistance
3. Semantic Search & Vector Embeddings
- Pinecone Vector Database: Store and query document embeddings
- Document Search: Search across uploaded PDFs and JSON documents
- Embedding Generation: Automatic vectorization of uploaded content
- Similarity Matching: Find relevant documents based on semantic meaning
4. Document Processing
- PDF Upload & Embedding: Upload PDF files, extract text, and create searchable embeddings
- JSON Upload & Storage: Process JSON data and store as vectors in Pinecone
- AWS S3 Integration: Secure document storage with presigned URL generation
- Multi-Format Support: Handle various document types for analysis
5. Interactive Components
- Project Timeline: Visual timeline for project milestones
- Project Roadmap: Feature planning and development tracking
- Upload Interface: Drag-and-drop file upload with progress tracking
- Search Interface: Query interface for semantic document search
Architecture
Code
Conversational Bot Platform (Next.js + Socket.io)
├── Client Layer (React + Socket.io Client)
│ ├── Chat Interface (useChat hook)
│ ├── Search Components (PDF/JSON search)
│ ├── Upload Components (file handling)
│ └── Project Views (timeline, roadmap)
├── Server Layer (Custom HTTP + Socket.io Server)
│ ├── Next.js Request Handler
│ ├── Socket.io Event Handlers
│ └── Message Management
├── API Routes (REST Endpoints)
│ ├── /api/chat/openai - OpenAI streaming chat
│ ├── /api/pinecone - Vector operations
│ ├── /api/pinecone/query - Search embeddings
│ ├── /api/pinecone/upsert - Insert embeddings
│ └── /api/messages - Message history
├── External Services
│ ├── OpenAI API (GPT-3.5-turbo)
│ ├── Pinecone (vector database)
│ └── AWS S3 (document storage)
└── Data Layer
├── In-Memory Message Store
├── Pinecone Index (embeddings)
└── S3 Buckets (documents)Integration Points
AI & Machine Learning
- OpenAI API: Chat completions with streaming support
- Pinecone: Vector database for semantic search and document embeddings
- AI SDK: Vercel's AI SDK for React integration
Cloud Services
- AWS S3: Document storage with SDK v3
- Client-side upload with presigned URLs
- Secure bucket access with IAM roles
- Vercel: Deployment platform (configuration ready)
Real-Time Communication
- Socket.io: WebSocket-based bidirectional communication
- Custom event handlers for messages
- Connection state management
- Client-server synchronization
Getting Started
Prerequisites
- Node.js 20+
- npm or yarn
- AWS credentials (for S3 access)
- OpenAI API key
- Pinecone API key and index
Environment Variables
Create a .env.local file in the root directory:
bash
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key
# Pinecone Configuration
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=your_index_name
# AWS S3 Configuration
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_REGION=your_aws_region
AWS_S3_BUCKET_NAME=your_bucket_nameInstallation
bash
# Clone the repository
git clone https://github.com/unparty-app/theunpartybot.git
cd theunpartybot
# Install dependencies
npm install
# Run development server
npm run devThe application will be available at http://localhost:3000
Production Build
bash
# Build for production
npm run build
# Start production server
npm startProject Structure
Code
theunpartybot/
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── page.tsx # Main landing page
│ │ ├── layout.tsx # Root layout
│ │ ├── globals.css # Global styles
│ │ └── chat/ # Chat page route
│ ├── pages/
│ │ └── api/ # API routes
│ │ ├── chat/
│ │ │ └── openai.ts # OpenAI streaming endpoint
│ │ ├── pinecone/
│ │ │ ├── query.ts # Vector search
│ │ │ └── upsert.ts # Vector insertion
│ │ └── messages.ts # Message history API
│ ├── components/ # React components
│ │ ├── ChatBox.tsx # Main chat interface
│ │ ├── Messages.tsx # Message display
│ │ ├── InputBox.tsx # Message input
│ │ ├── Upload.tsx # File upload
│ │ ├── PDFSearch.tsx # PDF search interface
│ │ ├── JSONSearch.tsx # JSON search interface
│ │ ├── PineconeComponent.tsx # Pinecone operations
│ │ ├── JsonUploadEmbedAndStore.tsx # JSON processing
│ │ ├── About.tsx # Project timeline
│ │ └── ProjectRoadmap.tsx # Feature roadmap
│ └── utility/
│ └── pineconeClient.ts # Pinecone SDK initialization
├── server.ts # Custom Node.js server with Socket.io
├── messageHandler.ts # Socket.io event handlers
├── package.json # Dependencies and scripts
└── tsconfig.json # TypeScript configurationBusiness Value
ABOUT
Understanding through Conversation: theunpartybot helps users understand the UNPARTY ecosystem through intelligent, context-aware conversations. The semantic search capabilities allow users to explore documentation, find relevant information, and learn about features through natural language queries.
BUILD
Creating with AI Assistance: Developers and creators can use the bot to:
- Search technical documentation across uploaded PDFs and JSON files
- Get AI-powered responses to development questions
- Process and embed project documentation for team-wide access
- Track project timelines and roadmaps
CONNECT
Sharing Knowledge: The platform facilitates knowledge sharing through:
- Real-time chat capabilities for collaborative problem-solving
- Searchable knowledge base via Pinecone embeddings
- Document processing pipeline that makes content discoverable
- Interactive interfaces that encourage exploration and engagement
Relationship to UNPARTY Ecosystem
theunpartybot serves as an intelligent interface layer for the UNPARTY ecosystem:
Integration with Core Repositories
- theunpartyapp (Web Platform): Bot can provide conversational access to content managed in the web platform
- theunpartyunppp (Native App): Potential integration for AI-assisted journaling and content suggestions
- theunpartyrunway (Dev Tools): Bot can answer questions about development workflows, cost tracking, and project analytics
- theunpartycrawler (Analytics): Bot can process conversation analytics data and provide insights
Data Flow
Strategic Value
- Knowledge Centralization: Acts as a unified interface to query information across UNPARTY repositories
- AI-First Approach: Demonstrates UNPARTY's commitment to intelligent, user-friendly tools
- Developer Productivity: Reduces time spent searching documentation through semantic search
- User Engagement: Provides an interactive, conversational way to explore UNPARTY products
Development Workflow
Running Linter
bash
npm run lintBuilding the Project
bash
npm run buildAvailable Scripts
npm run dev- Start development server with hot reloadnpm run build- Create production buildnpm start- Start production servernpm run lint- Run ESLint to check code quality
Technology Decisions
Why Next.js 14?
- Hybrid Routing: Supports both Pages Router (for API routes) and App Router (for modern React features)
- Server-Side Rendering: Improves SEO and initial load performance
- API Routes: Built-in backend capabilities without separate server setup
- Vercel Optimization: Seamless deployment and edge functions
Why Socket.io?
- Real-Time Communication: Enables instant message delivery without polling
- Reliability: Automatic reconnection and fallback mechanisms
- Event-Based Architecture: Clean separation of concerns with custom event handlers
Why Pinecone?
- Semantic Search: Vector-based similarity matching for intelligent document retrieval
- Scalability: Managed service that handles millions of vectors
- Low Latency: Fast query responses for real-time search
Why OpenAI?
- State-of-the-Art AI: GPT-3.5-turbo provides high-quality conversational responses
- Streaming Support: Progressive response rendering for better UX
- Ecosystem Integration: Works seamlessly with Vercel AI SDK
Alignment with UNPARTY Values
Creator Ownership
- Users control their uploaded documents
- Transparent AI interactions with clear data flow
- Export capabilities for user-generated content
Privacy Protection
- Secure document storage with AWS S3 presigned URLs
- API keys and credentials managed via environment variables
- No client-side storage of sensitive information
Cost Sensitivity
- Efficient vector storage to minimize Pinecone costs
- Streaming responses to reduce OpenAI token usage
- In-memory message storage to avoid database costs for transient data
Future Enhancements
- Multi-user chat rooms with role-based access
- Advanced document processing (images, audio transcription)
- Integration with theunpartyapp for content sync
- Claude API integration for alternative AI models
- Enhanced analytics dashboard for conversation insights
- Voice input/output for accessibility
- Mobile-responsive improvements
- Webhook support for external integrations
Contributing
This repository follows UNPARTY's development standards:
- Code Quality: Use TypeScript with strict type checking
- Linting: Run
npm run lintbefore commits - Documentation: Update README when adding features
- Testing: Add tests for new API endpoints (when test infrastructure is added)
- Commits: Use clear, descriptive commit messages
Related Documentation
- Next.js Documentation
- Socket.io Documentation
- OpenAI API Reference
- Pinecone Documentation
- Vercel AI SDK
- AWS SDK for JavaScript v3
Support
For questions or issues:
- Open an issue in this repository
- Visit unparty.app
- Review ecosystem documentation in theunpartyrunway
Last Updated: 2025-10-29
Maintained By: UNPARTY Development Team
Part of: UNPARTY Ecosystem (Bot Intelligence Layer)
License
Copyright © 2025 UNPARTY LLC. All rights reserved.