Skip to content

A sophisticated AI-powered funding platform that intelligently matches donors with impactful projects and campaigns on the NEAR blockchain

Notifications You must be signed in to change notification settings

PotLock/funding-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Funding AI - Intelligent Funding Platform

A sophisticated AI-powered funding platform that intelligently matches donors with impactful projects and campaigns on the NEAR blockchain. The platform uses advanced search algorithms, vector similarity, and LLM-based evaluation to provide personalized funding recommendations.

๐Ÿš€ Features

Core Functionality

  • ๐Ÿ” Intelligent Search: Vector similarity search across projects and campaigns
  • ๐Ÿค– AI-Powered Evaluation: LLM-based relevance scoring and holistic evaluation
  • ๐Ÿ“Š Smart Ranking: Hybrid ranking combining similarity scores and AI evaluation
  • ๐ŸŽฏ Personalized Recommendations: Weighted allocation based on user preferences
  • ๐ŸŒ Multi-Platform Integration: Support for projects and campaigns from Potlock ecosystem

Search & Discovery

  • Unified Search: Search across both projects and campaigns simultaneously
  • Tabbed Interface: View "All", "Projects", or "Campaigns" separately
  • Real-time Results: Live data fetching from NEAR smart contracts
  • Rich Metadata: Display images, descriptions, social links, and evaluation scores

Evaluation System

  • Relevance Scoring: AI evaluation of query relevance (0-10 scale)
  • Impact Assessment: Evaluation of project/campaign potential impact
  • Funding Needs Analysis: Assessment of funding requirements and urgency
  • Holistic Reports: Comprehensive evaluation reports for each item

๐Ÿ—๏ธ Technical Architecture

Frontend Stack

  • Framework: Next.js 14 with TypeScript
  • Styling: Tailwind CSS with custom design system
  • State Management: React hooks with local state
  • UI Components: Custom components with responsive design
  • Icons: Feather Icons for consistent iconography

Backend & AI

  • Search Engine: LangChain MemoryVectorStore for vector similarity search
  • Embeddings: OpenAI text-embedding-ada-002 for semantic search
  • LLM Integration: OpenAI GPT-3.5-turbo for evaluation and ranking
  • API Routes: Next.js API routes for search functionality

Blockchain Integration

  • NEAR Protocol: Direct integration with NEAR blockchain
  • Smart Contracts:
    • Potlock Projects Contract (v1.social08.near)
    • Potlock Campaigns Contract (v1.campaigns.staging.potlock.near)
  • Data Fetching: Real-time data from NEAR RPC endpoints
  • Profile Enrichment: Integration with social.near for project metadata

Search Pipeline

  1. Data Ingestion: Fetch projects and campaigns from smart contracts
  2. Vector Embedding: Convert text content to vector embeddings
  3. Similarity Search: Find relevant items using vector similarity
  4. LLM Reranking: Use GPT-3.5-turbo to rerank results by relevance
  5. Holistic Evaluation: Generate comprehensive evaluation reports
  6. Scoring: Assign scores for relevance, impact, and funding needs
  7. Weighted Allocation: Calculate allocation percentages based on scores

๐Ÿ”ง Implementation Details

Search Algorithm

// Hybrid search combining vector similarity and LLM evaluation
const searchPipeline = async (query: string) => {
  // 1. Vector similarity search
  const vectorResults = await vectorStore.similaritySearch(query, topK);
  
  // 2. LLM reranking
  const rerankedResults = await rerankWithOpenAI(query, vectorResults);
  
  // 3. Holistic evaluation
  const evaluations = await Promise.all(
    rerankedResults.map(result => generateEvaluationReport(query, result))
  );
  
  // 4. Scoring and allocation
  const scoredResults = await Promise.all(
    evaluations.map(evaluation => scoreEvaluationReport(evaluation))
  );
  
  return scoredResults;
};

Data Processing

  • Project Data: Enriched with profile information from social.near
  • Campaign Data: Direct from Potlock campaigns contract
  • Image Handling: IPFS integration for project logos and images
  • Social Links: Automatic URL formatting for various platforms

URL Formatting

The platform automatically formats social media URLs:

  • Twitter/X: https://x.com/{username}
  • GitHub: https://github.com/{username}
  • Telegram: https://t.me/{username}
  • Discord: https://discord.gg/{invite}
  • LinkedIn: https://www.linkedin.com/in/{profile}
  • Website: https://{domain}

๐Ÿ“ Project Structure

funding-ai/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ search/
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ route.ts          # Search API endpoint
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ page.tsx              # Dashboard page
โ”‚   โ”‚   โ”œโ”€โ”€ globals.css               # Global styles
โ”‚   โ”‚   โ”œโ”€โ”€ layout.tsx                # Root layout
โ”‚   โ”‚   โ””โ”€โ”€ page.tsx                  # Main search interface
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ Footer.tsx                # Footer component
โ”‚   โ”‚   โ””โ”€โ”€ Header.tsx                # Header component
โ”‚   โ””โ”€โ”€ contexts/
โ”‚       โ””โ”€โ”€ WalletSelectorContext.tsx # NEAR wallet integration
โ”œโ”€โ”€ package.json                      # Dependencies and scripts
โ”œโ”€โ”€ tailwind.config.js               # Tailwind configuration
โ””โ”€โ”€ tsconfig.json                    # TypeScript configuration

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • NEAR account (for blockchain interactions)
  • OpenAI API key (for AI features)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/funding-ai.git
    cd funding-ai
  2. Install dependencies:

    npm install
  3. Environment setup:

    cp .env.example .env.local
    # Add your OpenAI API key and other environment variables
  4. Run development server:

    npm run dev
  5. Open http://localhost:3000 in your browser

Environment Variables

OPENAI_API_KEY=your_openai_api_key_here
NEAR_NETWORK_ID=testnet
NEAR_NODE_URL=https://rpc.testnet.near.org

๐Ÿ” Usage

Search Interface

  1. Enter your funding interests in the search bar
  2. Browse results across the "All", "Projects", and "Campaigns" tabs
  3. Review evaluation scores for relevance, impact, and funding needs
  4. Select items you want to fund
  5. Configure funding amount and strategy
  6. Execute donations through the funding modal

Search Features

  • Real-time search: Results update as you type
  • Smart suggestions: Pre-defined search suggestions for common interests
  • Rich results: View images, descriptions, social links, and evaluation scores
  • Campaign URLs: Direct links to campaign pages on Potlock platform

๐Ÿ› ๏ธ Development

Available Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run start        # Start production server
npm run lint         # Run ESLint
npm run type-check   # Run TypeScript type checking

Key Components

Search API (/api/search)

  • Vector similarity search using LangChain
  • LLM-based reranking with OpenAI GPT-3.5-turbo
  • Holistic evaluation with comprehensive scoring
  • Real-time data fetching from NEAR smart contracts

Main Interface (page.tsx)

  • Responsive design with Tailwind CSS
  • Tabbed interface for different result types
  • Modal system for detailed item views
  • Funding workflow with amount selection and strategy

Data Processing

  • Project enrichment with social.near integration
  • Campaign data from Potlock contracts
  • Image handling with IPFS integration
  • Social link formatting for various platforms

๐Ÿ”ฎ Future Enhancements

Planned Features

  • Advanced filtering by category, funding amount, and impact area
  • User preferences and personalized recommendations
  • Donation history and tracking
  • Social features for sharing and collaboration
  • Analytics dashboard for funding impact

Technical Improvements

  • Caching layer for improved performance
  • Real-time updates for live data
  • Advanced AI models for better evaluation
  • Multi-chain support for other blockchains
  • Mobile app for on-the-go funding

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • NEAR Protocol for blockchain infrastructure
  • Potlock for campaign and project data
  • OpenAI for AI capabilities
  • LangChain for vector search functionality
  • Tailwind CSS for styling framework

Built with โค๏ธ for the NEAR ecosystem

About

A sophisticated AI-powered funding platform that intelligently matches donors with impactful projects and campaigns on the NEAR blockchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages