Skip to content

Commit 69bd93b

Browse files
v3
2 parents 1cdfe57 + 9b662c9 commit 69bd93b

File tree

320 files changed

+38657
-7522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

320 files changed

+38657
-7522
lines changed

.cursor/mcp.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"dev3000": {
4+
"type": "http",
5+
"url": "http://localhost:3684/mcp"
6+
}
7+
}
8+
}

.env.example

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,46 @@
1-
# REQUIRED - Sandboxes for code execution
2-
# Get yours at https://e2b.dev
3-
E2B_API_KEY=your_e2b_api_key_here
1+
# Required
2+
FIRECRAWL_API_KEY=your_firecrawl_api_key # Get from https://firecrawl.dev (Web scraping)
43

5-
# REQUIRED - Web scraping for cloning websites
6-
# Get yours at https://firecrawl.dev
7-
FIRECRAWL_API_KEY=your_firecrawl_api_key_here
4+
# =================================================================================
5+
# SANDBOX PROVIDER - Choose Option 1 OR 2
6+
# =================================================================================
87

9-
# OPTIONAL - AI Providers (need at least one)
10-
# Get yours at https://console.anthropic.com
11-
ANTHROPIC_API_KEY=your_anthropic_api_key_here
8+
# Option 1: Vercel Sandbox (recommended - default)
9+
# Set SANDBOX_PROVIDER=vercel and choose authentication method below
10+
SANDBOX_PROVIDER=vercel
1211

13-
# Get yours at https://platform.openai.com
14-
OPENAI_API_KEY=your_openai_api_key_here
12+
# Vercel Authentication - Choose method a OR b
13+
# Method a: OIDC Token (recommended for development)
14+
# Run `vercel link` then `vercel env pull` to get VERCEL_OIDC_TOKEN automatically
15+
VERCEL_OIDC_TOKEN=auto_generated_by_vercel_env_pull
1516

16-
# Get yours at https://aistudio.google.com/app/apikey
17-
GEMINI_API_KEY=your_gemini_api_key_here
17+
# Method b: Personal Access Token (for production or when OIDC unavailable)
18+
# VERCEL_TEAM_ID=team_xxxxxxxxx # Your Vercel team ID
19+
# VERCEL_PROJECT_ID=prj_xxxxxxxxx # Your Vercel project ID
20+
# VERCEL_TOKEN=vercel_xxxxxxxxxxxx # Personal access token from Vercel dashboard
1821

1922
# Get yours at https://console.groq.com
20-
GROQ_API_KEY=your_groq_api_key_here
23+
GROQ_API_KEY=your_groq_api_key_here
24+
25+
=======
26+
# Option 2: E2B Sandbox
27+
# Set SANDBOX_PROVIDER=e2b and configure E2B_API_KEY below
28+
# SANDBOX_PROVIDER=e2b
29+
# E2B_API_KEY=your_e2b_api_key # Get from https://e2b.dev
30+
31+
# =================================================================================
32+
# AI PROVIDERS - Need at least one
33+
# =================================================================================
34+
35+
# Vercel AI Gateway (recommended - provides access to multiple models)
36+
AI_GATEWAY_API_KEY=your_ai_gateway_api_key # Get from https://vercel.com/dashboard/ai-gateway/api-keys
37+
38+
# Individual provider keys (used when AI_GATEWAY_API_KEY is not set)
39+
ANTHROPIC_API_KEY=your_anthropic_api_key # Get from https://console.anthropic.com
40+
OPENAI_API_KEY=your_openai_api_key # Get from https://platform.openai.com (GPT-5)
41+
GEMINI_API_KEY=your_gemini_api_key # Get from https://aistudio.google.com/app/apikey
42+
GROQ_API_KEY=your_groq_api_key # Get from https://console.groq.com (Fast inference - Kimi K2 recommended)
43+
44+
# Optional Morph Fast Apply
45+
# Get yours at https://morphllm.com/
46+
MORPH_API_KEY=your_fast_apply_key

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ e2b-template-*
5656
*.temp
5757
repomix-output.txt
5858
bun.lockb
59+
.env*.local

README.md

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,67 @@
11
# Open Lovable
22

3-
Chat with AI to build React apps instantly. An example app made by the [Firecrawl](https://firecrawl.dev/?ref=open-lovable-github) team. For a complete cloud solution, check out [Lovable.dev ❤️](https://lovable.dev/).
3+
Chat with AI to build React apps instantly. An example app made by the [Firecrawl](https://firecrawl.dev/?ref=open-lovable-github) team. For a complete cloud solution, check out [Lovable.dev](https://lovable.dev/) ❤️.
44

55
<img src="https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExbmZtaHFleGRsMTNlaWNydGdianI4NGQ4dHhyZjB0d2VkcjRyeXBucCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/ZFVLWMa6dVskQX0qu1/giphy.gif" alt="Open Lovable Demo" width="100%"/>
66

7-
8-
97
## Setup
108

119
1. **Clone & Install**
1210
```bash
13-
git clone https://github.com/mendableai/open-lovable.git
11+
git clone https://github.com/firecrawl/open-lovable.git
1412
cd open-lovable
15-
npm install
13+
pnpm install # or npm install / yarn install
1614
```
1715

1816
2. **Add `.env.local`**
17+
1918
```env
20-
# Required
21-
E2B_API_KEY=your_e2b_api_key # Get from https://e2b.dev (Sandboxes)
22-
FIRECRAWL_API_KEY=your_firecrawl_api_key # Get from https://firecrawl.dev (Web scraping)
23-
24-
# Optional (need at least one AI provider)
25-
ANTHROPIC_API_KEY=your_anthropic_api_key # Get from https://console.anthropic.com
26-
OPENAI_API_KEY=your_openai_api_key # Get from https://platform.openai.com (GPT-5)
27-
GEMINI_API_KEY=your_gemini_api_key # Get from https://aistudio.google.com/app/apikey
28-
GROQ_API_KEY=your_groq_api_key # Get from https://console.groq.com (Fast inference - Kimi K2 recommended)
19+
# =================================================================
20+
# REQUIRED
21+
# =================================================================
22+
FIRECRAWL_API_KEY=your_firecrawl_api_key # https://firecrawl.dev
23+
24+
# =================================================================
25+
# AI PROVIDER - Choose your LLM
26+
# =================================================================
27+
GEMINI_API_KEY=your_gemini_api_key # https://aistudio.google.com/app/apikey
28+
ANTHROPIC_API_KEY=your_anthropic_api_key # https://console.anthropic.com
29+
OPENAI_API_KEY=your_openai_api_key # https://platform.openai.com
30+
GROQ_API_KEY=your_groq_api_key # https://console.groq.com
31+
32+
# =================================================================
33+
# FAST APPLY (Optional - for faster edits)
34+
# =================================================================
35+
MORPH_API_KEY=your_morphllm_api_key # https://morphllm.com/dashboard
36+
37+
# =================================================================
38+
# SANDBOX PROVIDER - Choose ONE: Vercel (default) or E2B
39+
# =================================================================
40+
SANDBOX_PROVIDER=vercel # or 'e2b'
41+
42+
# Option 1: Vercel Sandbox (default)
43+
# Choose one authentication method:
44+
45+
# Method A: OIDC Token (recommended for development)
46+
# Run `vercel link` then `vercel env pull` to get VERCEL_OIDC_TOKEN automatically
47+
VERCEL_OIDC_TOKEN=auto_generated_by_vercel_env_pull
48+
49+
# Method B: Personal Access Token (for production or when OIDC unavailable)
50+
# VERCEL_TEAM_ID=team_xxxxxxxxx # Your Vercel team ID
51+
# VERCEL_PROJECT_ID=prj_xxxxxxxxx # Your Vercel project ID
52+
# VERCEL_TOKEN=vercel_xxxxxxxxxxxx # Personal access token from Vercel dashboard
53+
54+
# Option 2: E2B Sandbox
55+
# E2B_API_KEY=your_e2b_api_key # https://e2b.dev
2956
```
3057

3158
3. **Run**
3259
```bash
33-
npm run dev
60+
pnpm dev # or npm run dev / yarn dev
3461
```
3562

36-
Open [http://localhost:3000](http://localhost:3000)
63+
Open [http://localhost:3000](http://localhost:3000)
3764

3865
## License
3966

40-
MIT
67+
MIT

app/api/analyze-edit-intent/route.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,30 @@ import { createOpenAI } from '@ai-sdk/openai';
55
import { createGoogleGenerativeAI } from '@ai-sdk/google';
66
import { generateObject } from 'ai';
77
import { z } from 'zod';
8-
import type { FileManifest } from '@/types/file-manifest';
8+
// import type { FileManifest } from '@/types/file-manifest'; // Type is used implicitly through manifest parameter
9+
10+
// Check if we're using Vercel AI Gateway
11+
const isUsingAIGateway = !!process.env.AI_GATEWAY_API_KEY;
12+
const aiGatewayBaseURL = 'https://ai-gateway.vercel.sh/v1';
913

1014
const groq = createGroq({
11-
apiKey: process.env.GROQ_API_KEY,
15+
apiKey: process.env.AI_GATEWAY_API_KEY ?? process.env.GROQ_API_KEY,
16+
baseURL: isUsingAIGateway ? aiGatewayBaseURL : undefined,
1217
});
1318

1419
const anthropic = createAnthropic({
15-
apiKey: process.env.ANTHROPIC_API_KEY,
16-
baseURL: process.env.ANTHROPIC_BASE_URL || 'https://api.anthropic.com/v1',
20+
apiKey: process.env.AI_GATEWAY_API_KEY ?? process.env.ANTHROPIC_API_KEY,
21+
baseURL: isUsingAIGateway ? aiGatewayBaseURL : (process.env.ANTHROPIC_BASE_URL || 'https://api.anthropic.com/v1'),
1722
});
1823

1924
const openai = createOpenAI({
20-
apiKey: process.env.OPENAI_API_KEY,
21-
baseURL: process.env.OPENAI_BASE_URL,
25+
apiKey: process.env.AI_GATEWAY_API_KEY ?? process.env.OPENAI_API_KEY,
26+
baseURL: isUsingAIGateway ? aiGatewayBaseURL : process.env.OPENAI_BASE_URL,
27+
});
28+
29+
const googleGenerativeAI = createGoogleGenerativeAI({
30+
apiKey: process.env.AI_GATEWAY_API_KEY ?? process.env.GEMINI_API_KEY,
31+
baseURL: isUsingAIGateway ? aiGatewayBaseURL : undefined,
2232
});
2333

2434
// Schema for the AI's search plan - not file selection!
@@ -66,15 +76,15 @@ export async function POST(request: NextRequest) {
6676

6777
// Create a summary of available files for the AI
6878
const validFiles = Object.entries(manifest.files as Record<string, any>)
69-
.filter(([path, info]) => {
79+
.filter(([path]) => {
7080
// Filter out invalid paths
7181
return path.includes('.') && !path.match(/\/\d+$/);
7282
});
7383

7484
const fileSummary = validFiles
7585
.map(([path, info]: [string, any]) => {
7686
const componentName = info.componentInfo?.name || path.split('/').pop();
77-
const hasImports = info.imports?.length > 0;
87+
// const hasImports = info.imports?.length > 0; // Kept for future use
7888
const childComponents = info.componentInfo?.childComponents?.join(', ') || 'none';
7989
return `- ${path} (${componentName}, renders: ${childComponents})`;
8090
})
@@ -104,7 +114,7 @@ export async function POST(request: NextRequest) {
104114
aiModel = openai(model.replace('openai/', ''));
105115
}
106116
} else if (model.startsWith('google/')) {
107-
aiModel = createGoogleGenerativeAI(model.replace('google/', ''));
117+
aiModel = googleGenerativeAI(model.replace('google/', ''));
108118
} else {
109119
// Default to groq if model format is unclear
110120
aiModel = groq(model);

0 commit comments

Comments
 (0)