nextjs-hackathon-stack 0.1.9 → 0.1.11

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.11",
4
4
  "description": "Scaffold a full-stack Next.js hackathon starter",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,11 +9,13 @@ 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
- # Vercel AI Gatewayhttps://vercel.com > AI > Gateways
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
12
+ # AI Providerdefaults to MiniMax direct API
13
+ AI_API_KEY=your-api-key
14
+ # Optional: override base URL (default: https://api.minimaxi.chat/v1)
15
+ # For Vercel Gateway: https://ai-gateway.vercel.sh/v1
16
+ # AI_BASE_URL=https://api.minimaxi.chat/v1
17
+ # Optional: override model (default: MiniMax-M1)
18
+ # AI_MODEL=MiniMax-M1
17
19
 
18
20
  # =============================================================================
19
21
  # OPTIONAL
@@ -1,4 +1,5 @@
1
1
  import { ChatUi } from "@/features/chat/components/chat-ui";
2
+ import { logoutAction } from "@/features/auth/actions/logout.action";
2
3
  import { createClient } from "@/shared/lib/supabase/server";
3
4
 
4
5
  export default async function HomePage() {
@@ -9,7 +10,14 @@ export default async function HomePage() {
9
10
 
10
11
  return (
11
12
  <main className="container mx-auto p-8">
12
- <h1 className="mb-4 text-2xl font-bold">Welcome, {user?.email}</h1>
13
+ <div className="mb-4 flex items-center justify-between">
14
+ <h1 className="text-2xl font-bold">Welcome, {user?.email}</h1>
15
+ <form action={logoutAction}>
16
+ <button type="submit" className="rounded bg-gray-200 px-4 py-2 text-sm hover:bg-gray-300">
17
+ Log out
18
+ </button>
19
+ </form>
20
+ </div>
13
21
  <ChatUi />
14
22
  </main>
15
23
  );
@@ -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,8 +1,8 @@
1
1
  import { createOpenAI } from "@ai-sdk/openai";
2
2
 
3
- const gateway = createOpenAI({
4
- baseURL: process.env.AI_GATEWAY_URL ?? "https://gateway.ai.vercel.app/v1",
5
- apiKey: process.env.AI_GATEWAY_API_KEY ?? "",
3
+ const provider = createOpenAI({
4
+ baseURL: process.env.AI_BASE_URL ?? "https://api.minimaxi.chat/v1",
5
+ apiKey: process.env.AI_API_KEY ?? "",
6
6
  });
7
7
 
8
- export const aiModel = gateway("minimax/minimax-m2.7");
8
+ export const aiModel = provider(process.env.AI_MODEL ?? "MiniMax-M1");