nextjs-hackathon-stack 0.1.8 → 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
package/template/_env.example
CHANGED
|
@@ -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
|
-
|
|
17
|
-
|
|
13
|
+
AI_GATEWAY_API_KEY=your-ai-gateway-api-key
|
|
14
|
+
|
|
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
|
|
18
17
|
|
|
19
18
|
# =============================================================================
|
|
20
19
|
# OPTIONAL
|
|
@@ -13,5 +13,10 @@ export async function POST(req: Request) {
|
|
|
13
13
|
maxTokens: 2048,
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
return result.toDataStreamResponse(
|
|
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
|
+
});
|
|
17
22
|
}
|
|
@@ -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://
|
|
5
|
-
apiKey: process.env.
|
|
4
|
+
baseURL: process.env.AI_GATEWAY_URL ?? "https://ai-gateway.vercel.sh/v1",
|
|
5
|
+
apiKey: process.env.AI_GATEWAY_API_KEY ?? "",
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
export const aiModel = gateway("minimax/minimax-m2.7");
|