mirror of
https://github.com/vercel-labs/json-render.git
synced 2026-10-02 12:00:58 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39a77bfaad | ||
|
|
43756783fe | ||
|
|
af9dd04085 |
@@ -1,4 +1,9 @@
|
||||
# AI Gateway API Key (required for /api/generate endpoint)
|
||||
# Uses Vercel AI Gateway - automatically authenticated when deployed on Vercel
|
||||
# Vercel AI Gateway
|
||||
# Automatically authenticated when deployed on Vercel
|
||||
# For local development, get your key from https://vercel.com/ai-gateway
|
||||
AI_GATEWAY_API_KEY=
|
||||
|
||||
# AI Model Configuration
|
||||
# Override the default model used for UI generation
|
||||
# Default: anthropic/claude-haiku-4.5
|
||||
AI_GATEWAY_MODEL=anthropic/claude-haiku-4.5
|
||||
|
||||
@@ -78,6 +78,7 @@ EXAMPLE (Blog with responsive grid):
|
||||
Generate JSONL:`;
|
||||
|
||||
const MAX_PROMPT_LENGTH = 140;
|
||||
const DEFAULT_MODEL = "anthropic/claude-haiku-4.5";
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const { prompt } = await req.json();
|
||||
@@ -85,7 +86,7 @@ export async function POST(req: Request) {
|
||||
const sanitizedPrompt = String(prompt || "").slice(0, MAX_PROMPT_LENGTH);
|
||||
|
||||
const result = streamText({
|
||||
model: "anthropic/claude-opus-4.5",
|
||||
model: process.env.AI_GATEWAY_MODEL || DEFAULT_MODEL,
|
||||
system: SYSTEM_PROMPT,
|
||||
prompt: sanitizedPrompt,
|
||||
temperature: 0.7,
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function POST(req: Request) {
|
||||
: '';
|
||||
|
||||
const result = streamText({
|
||||
model: 'anthropic/claude-opus-4.5',
|
||||
model: 'anthropic/claude-haiku-4.5',
|
||||
system: systemPrompt + contextPrompt,
|
||||
prompt,
|
||||
});
|
||||
|
||||
@@ -100,7 +100,7 @@ export async function POST(req: Request) {
|
||||
const systemPrompt = generateCatalogPrompt(catalog);
|
||||
|
||||
const result = streamText({
|
||||
model: 'anthropic/claude-opus-4.5',
|
||||
model: 'anthropic/claude-haiku-4.5',
|
||||
system: systemPrompt,
|
||||
prompt,
|
||||
});
|
||||
|
||||
@@ -79,7 +79,7 @@ function App() {
|
||||
const { prompt } = await req.json();
|
||||
|
||||
const result = streamText({
|
||||
model: 'anthropic/claude-opus-4.5',
|
||||
model: 'anthropic/claude-haiku-4.5',
|
||||
system: generateCatalogPrompt(catalog),
|
||||
prompt,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# AI Gateway API Key (required for /api/generate endpoint)
|
||||
# Uses Vercel AI Gateway - automatically authenticated when deployed on Vercel
|
||||
# Vercel AI Gateway
|
||||
# Automatically authenticated when deployed on Vercel
|
||||
# For local development, get your key from https://vercel.com/ai-gateway
|
||||
AI_GATEWAY_API_KEY=
|
||||
|
||||
# AI Model Configuration
|
||||
# Override the default model used for dashboard generation
|
||||
# Default: anthropic/claude-haiku-4.5
|
||||
AI_GATEWAY_MODEL=anthropic/claude-haiku-4.5
|
||||
|
||||
@@ -58,6 +58,8 @@ EXAMPLE - Revenue Dashboard:
|
||||
|
||||
Generate JSONL patches now:`;
|
||||
|
||||
const DEFAULT_MODEL = "anthropic/claude-haiku-4.5";
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const { prompt, context } = await req.json();
|
||||
|
||||
@@ -69,7 +71,7 @@ export async function POST(req: Request) {
|
||||
}
|
||||
|
||||
const result = streamText({
|
||||
model: "anthropic/claude-opus-4.5",
|
||||
model: process.env.AI_GATEWAY_MODEL || DEFAULT_MODEL,
|
||||
system: SYSTEM_PROMPT,
|
||||
prompt: fullPrompt,
|
||||
temperature: 0.7,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@json-render/codegen",
|
||||
"version": "0.1.0",
|
||||
"version": "0.3.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "Utilities for generating code from json-render UI trees",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@json-render/core",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "JSON becomes real things. Define your catalog, register your components, let AI generate.",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@json-render/react",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "React renderer for @json-render/core. JSON becomes React components.",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"$schema": "https://turborepo.dev/schema.json",
|
||||
"ui": "tui",
|
||||
"globalEnv": ["AI_GATEWAY_MODEL"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
|
||||
Reference in New Issue
Block a user