Skip to content

Fork update#1

Merged
Meugenn merged 2 commits intoMeugenn:mainfrom
rexheng:main
Feb 13, 2026
Merged

Fork update#1
Meugenn merged 2 commits intoMeugenn:mainfrom
rexheng:main

Conversation

@rexheng
Copy link
Copy Markdown
Collaborator

@rexheng rexheng commented Feb 13, 2026

No description provided.

- Convert Express backend to 11 Vercel serverless functions (api/)
- Replace WebSocket with polling for Republic/Swarm engines
- Update all frontend files to use same-origin /api/ paths
- Remove Docker files, shell scripts, temp files, build artifacts
- Remove deployment.json and .env.production from git tracking
- Update .gitignore with comprehensive exclusions
- Add security headers to vercel.json
- Rewrite README for production deployment
- KaggleLab gracefully degrades when no backend is configured
Copilot AI review requested due to automatic review settings February 13, 2026 16:01
@Meugenn Meugenn merged commit dde1c9c into Meugenn:main Feb 13, 2026
5 of 8 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR transforms the architecture from a traditional full-stack application to a Vercel serverless deployment model, with significant security improvements and infrastructure modernization.

Changes:

  • Serverless Migration: Refactored backend services into Vercel serverless functions under /api directory
  • Security Hardening: Moved all API keys from frontend to backend proxies, preventing client-side exposure
  • Smart Contract Optimizations: Fixed O(n) review lookup with paperReviewIds mapping and improved reviewer registry
  • Frontend Refactoring: Added Privy auth integration, new UI components (SearchTab, SamplesTab, PdfTab, etc.), improved LLM abstraction
  • Documentation: Removed outdated deployment guides, added SECURITY_GUIDE.md and CLAUDE.md

Reviewed changes

Copilot reviewed 106 out of 112 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
vercel.json Added security headers, caching rules, API routing for serverless deployment
contracts/ResearchGraph.sol Performance optimization: paperReviewIds mapping, fixed _getActiveReviewers, reviewerList tracking
frontend/src/config.jsx Removed hardcoded S2_API_KEY, enabled backend proxy for all API calls
frontend/src/utils/llm.jsx Refactored to use backend /api/llm/chat proxy, API keys in sessionStorage
api/* Added 11 serverless functions for LLM, KG, oracle, blockchain, etc.
frontend/src/components/* Added 8 new components (ApiKeySettings, AgentReviewPanel, SearchTab, etc.)
backend/services/* Improved error handling, removed unused methods, added JSDoc comments
SECURITY_GUIDE.md New comprehensive security documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 353 to 373
function _getActiveReviewers() internal view returns (address[] memory) {
// Simplified: return mock reviewers for demo
// In production, iterate through all reviewers
address[] memory active = new address[](5);
// Count active reviewers first
uint256 count = 0;
for (uint256 i = 0; i < reviewerList.length; i++) {
if (reviewers[reviewerList[i]].isActive) {
count++;
}
}

// Build array of active reviewers
address[] memory active = new address[](count);
uint256 idx = 0;
for (uint256 i = 0; i < reviewerList.length; i++) {
if (reviewers[reviewerList[i]].isActive) {
active[idx] = reviewerList[i];
idx++;
}
}

// This would iterate through a reviewer registry in production
return active;
}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _getActiveReviewers implementation has been fixed. Previously it returned a hardcoded mock array. Now it properly iterates through the reviewerList to collect active reviewers. However, this introduces unbounded gas consumption as reviewerList can grow indefinitely. Consider implementing pagination or a maximum limit for this function, especially since it's called during paper submission.

Copilot uses AI. Check for mistakes.
Comment thread api/llm/chat.js
// Auto-detect provider from key prefix
if (userApiKey) {
const detected = detectProviderFromKey(userApiKey);
if (detected && detected !== provider) provider = detected;
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLM proxy serverless function implements provider auto-detection from key prefix (AIza=gemini, sk-=openai/openrouter). While convenient, this could lead to confusion if a user selects one provider but their key matches another. Consider adding explicit validation that warns users when detected provider doesn't match selected provider, rather than silently switching.

Suggested change
if (detected && detected !== provider) provider = detected;
if (detected) {
if (!provider) {
// No provider explicitly selected; use detected provider
provider = detected;
} else if (detected !== provider) {
// Explicit provider and detected provider conflict; fail loudly instead of silently switching
throw new Error(
`Provider mismatch: selected "${provider}" but the API key looks like a "${detected}" key. ` +
'Please either change the selected provider or use an API key that matches your chosen provider.'
);
}
}

Copilot uses AI. Check for mistakes.
Comment thread frontend/src/App.jsx
import { motion, AnimatePresence } from 'framer-motion';
import { Wallet, ChevronDown, ExternalLink, Plus } from 'lucide-react';
import { CONTRACTS, NETWORKS, ABIS } from './config';
import { Wallet, ChevronDown, ExternalLink, Plus, LogOut, User as UserIcon, Settings } from 'lucide-react';
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused imports ChevronDown, ExternalLink.

Copilot uses AI. Check for mistakes.
const [pipelineRunning, setPipelineRunning] = useState(false);
const [finalReport, setFinalReport] = useState(null);
const [hasApiKey, setHasApiKey] = useState(false);
const [hasApiKey, setHasApiKey] = useState(true); // API keys are server-side now
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable setHasApiKey.

Copilot uses AI. Check for mistakes.
import { X, Eye, EyeOff, KeyRound, Check, Trash2, AlertTriangle, Info } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Badge } from '@/components/ui/badge';
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import Badge.

Copilot uses AI. Check for mistakes.
@@ -1,12 +1,12 @@
import React from 'react';
import { X, ExternalLink, Play, FlaskConical, ArrowUpRight } from 'lucide-react';
import { X, ExternalLink, Play, FlaskConical, ArrowUpRight, Trash2 } from 'lucide-react';
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import ExternalLink.

Copilot uses AI. Check for mistakes.
import { Trash2, ChevronUp, ChevronDown, ArrowUpDown } from 'lucide-react';
import { Badge } from '@/components/ui/badge';

const SORT_FIELDS = ['citationCount', 'title', 'year'];
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable SORT_FIELDS.

Copilot uses AI. Check for mistakes.
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.

3 participants