nextjs-hackathon-stack 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextjs-hackathon-stack",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Scaffold a full-stack Next.js hackathon starter",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,12 +9,11 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
9
9
  # Supabase DB — https://supabase.com > Project Settings > Database > Connection string (URI)
10
10
  DATABASE_URL=postgresql://postgres:[password]@db.your-project-id.supabase.co:5432/postgres
11
11
 
12
- # MiniMax — https://www.minimaxi.chat > API Keys
13
- MINIMAX_API_KEY=your-minimax-api-key
14
-
15
12
  # Vercel AI Gateway — https://vercel.com > AI > Gateways
16
- # Format: https://gateway.ai.vercel.app/v1/{team-id}/{gateway-id}
17
- AI_GATEWAY_URL=https://gateway.ai.vercel.app/v1/your-team-id/your-gateway-id
13
+ AI_GATEWAY_API_KEY=your-ai-gateway-api-key
14
+
15
+ # Optional: override the gateway base URL (defaults to https://gateway.ai.vercel.app/v1)
16
+ # AI_GATEWAY_URL=https://gateway.ai.vercel.app/v1
18
17
 
19
18
  # =============================================================================
20
19
  # OPTIONAL
@@ -7,11 +7,19 @@ export const runtime = "edge";
7
7
  export async function POST(req: Request) {
8
8
  const { messages } = (await req.json()) as { messages: CoreMessage[] };
9
9
 
10
- const result = streamText({
11
- model: aiModel,
12
- messages,
13
- maxTokens: 2048,
14
- });
10
+ try {
11
+ const result = streamText({
12
+ model: aiModel,
13
+ messages,
14
+ maxTokens: 2048,
15
+ });
15
16
 
16
- return result.toDataStreamResponse();
17
+ return result.toDataStreamResponse();
18
+ } catch (error) {
19
+ console.error("[chat] streamText error:", error);
20
+ return new Response(
21
+ JSON.stringify({ error: error instanceof Error ? error.message : "AI request failed" }),
22
+ { status: 500, headers: { "Content-Type": "application/json" } }
23
+ );
24
+ }
17
25
  }
@@ -1,8 +1,8 @@
1
1
  import { createOpenAI } from "@ai-sdk/openai";
2
2
 
3
3
  const gateway = createOpenAI({
4
- baseURL: process.env.AI_GATEWAY_URL ?? "https://api.minimaxi.chat/v1",
5
- apiKey: process.env.MINIMAX_API_KEY ?? "",
4
+ baseURL: process.env.AI_GATEWAY_URL ?? "https://gateway.ai.vercel.app/v1",
5
+ apiKey: process.env.AI_GATEWAY_API_KEY ?? "",
6
6
  });
7
7
 
8
8
  export const aiModel = gateway("minimax/minimax-m2.7");