-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(checkpoint): final form, server actions, reformatting
- Loading branch information
Showing
12 changed files
with
975 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
SUPABASE_URL=<your-supabase-url>.supabase.co | ||
SUPABASE_ANON_KEY=<your-anon-key> | ||
NEXT_PUBLIC_APP_URL=http://localhost:3000 | ||
NEXT_PUBLIC_APP_URL=http://localhost:3000 | ||
REPLICATE_API_TOKEN=<your-replicate-api-token> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Link from "next/link"; | ||
import { Button } from "./ui/button"; | ||
import Image from "next/image"; | ||
import { cn } from "@/lib/utils"; | ||
|
||
interface GenerateButtonProps { | ||
className?: string; | ||
text?: string; | ||
} | ||
|
||
function GenerateButton({ | ||
className, | ||
text = "Generate one for me", | ||
}: GenerateButtonProps) { | ||
return ( | ||
<Button | ||
asChild | ||
className={cn( | ||
className, | ||
"h-8 rounded-full px-4 py-2 text-base text-white shadow-xl transition duration-300 hover:bg-rose-600 md:h-12 md:px-6 md:py-3 md:text-xl lg:text-3xl", | ||
)} | ||
> | ||
<Link href="/generate"> | ||
<span className="flex items-center justify-center space-x-1 sm:space-x-2"> | ||
<Image | ||
src="/ph_heart-fill.svg" | ||
width={16} | ||
height={17} | ||
alt="Heart" | ||
className="h-3 w-3 sm:h-4 sm:w-4 md:h-5 md:w-5" | ||
/> | ||
<span>{text}</span> | ||
<Image | ||
src="/ph_heart-fill.svg" | ||
width={16} | ||
height={17} | ||
alt="Heart" | ||
className="h-3 w-3 sm:h-4 sm:w-4 md:h-5 md:w-5" | ||
/> | ||
</span> | ||
</Link> | ||
</Button> | ||
); | ||
} | ||
|
||
export default GenerateButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"use server"; | ||
|
||
import { generateObject } from "ai"; | ||
import { z } from "zod"; | ||
import { createStreamableValue } from "ai/rsc"; | ||
import { CoreMessage, streamText } from "ai"; | ||
import { OpenAI } from "openai"; | ||
import { openai } from "@ai-sdk/openai"; | ||
|
||
const anyscale = new OpenAI({ | ||
baseURL: "https://api.endpoints.anyscale.com/v1", | ||
apiKey: process.env.ANYSCALE_API_KEY!, | ||
}); | ||
|
||
async function chat_complete() { | ||
const completion = await anyscale.chat.completions.create({ | ||
model: "mistralai/Mixtral-8x22B-Instruct-v0.1", | ||
messages: [], | ||
temperature: 1, | ||
max_tokens: 256, | ||
top_p: 1, | ||
frequency_penalty: 0, | ||
}); | ||
console.log(completion); | ||
} | ||
|
||
export async function Generate(formData: FormData) { | ||
const { object } = await generateObject({ | ||
model: openai("mistralai/Mixtral-8x22B-Instruct-v0.1"), | ||
schema: z.object({ | ||
recipe: z.object({ | ||
name: z.string(), | ||
ingredients: z.array( | ||
z.object({ name: z.string(), amount: z.string() }), | ||
), | ||
steps: z.array(z.string()), | ||
}), | ||
}), | ||
prompt: "Generate a lasagna recipe.", | ||
}); | ||
} |
Oops, something went wrong.