nextjs-hackathon-stack 0.1.9 → 0.1.10

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.9",
3
+ "version": "0.1.10",
4
4
  "description": "Scaffold a full-stack Next.js hackathon starter",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,8 +12,8 @@ DATABASE_URL=postgresql://postgres:[password]@db.your-project-id.supabase.co:543
12
12
  # Vercel AI Gateway — https://vercel.com > AI > Gateways
13
13
  AI_GATEWAY_API_KEY=your-ai-gateway-api-key
14
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
15
+ # Optional: override the gateway base URL (defaults to https://ai-gateway.vercel.sh/v1)
16
+ # AI_GATEWAY_URL=https://ai-gateway.vercel.sh/v1
17
17
 
18
18
  # =============================================================================
19
19
  # OPTIONAL
@@ -7,19 +7,16 @@ 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
- try {
11
- const result = streamText({
12
- model: aiModel,
13
- messages,
14
- maxTokens: 2048,
15
- });
10
+ const result = streamText({
11
+ model: aiModel,
12
+ messages,
13
+ maxTokens: 2048,
14
+ });
16
15
 
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
- }
16
+ return result.toDataStreamResponse({
17
+ getErrorMessage: (error) => {
18
+ console.error("[chat] stream error:", error);
19
+ return error instanceof Error ? error.message : "AI request failed";
20
+ },
21
+ });
25
22
  }
@@ -1,7 +1,7 @@
1
1
  import { createOpenAI } from "@ai-sdk/openai";
2
2
 
3
3
  const gateway = createOpenAI({
4
- baseURL: process.env.AI_GATEWAY_URL ?? "https://gateway.ai.vercel.app/v1",
4
+ baseURL: process.env.AI_GATEWAY_URL ?? "https://ai-gateway.vercel.sh/v1",
5
5
  apiKey: process.env.AI_GATEWAY_API_KEY ?? "",
6
6
  });
7
7