Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update route.ts #78

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions app/api/toHtml/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,22 @@ export async function POST(request: Request) {
max_tokens: 4096,
messages: [
{
role: "system",
content: systemPrompt,
},
{
role: "user",
content: [
"role": "user",
"content": [
{"type": "text", "text": systemPrompt},
{
type: "image_url",
"type": "image_url",
image_url: { url: image, detail: "high" },
},
"Turn this into a single html file using tailwind.",
{"type": "text", "text": "Turn this into a single html file using tailwind."},
],
},
}
],
};

let json = null;
try {
const resp = await fetch("https://api.openai.com/v1/chat/completions", {
const resp = await fetch(`${process.env.OPENAI_BASE_URL}/v1/chat/completions`, {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change in the env is missing otherwise it will not work

method: "POST",
headers: {
"Content-Type": "application/json",
Expand All @@ -53,8 +50,12 @@ type MessageContent =
| (
| string
| {
type: "image_url";
image_url: string | { url: string; detail: "low" | "high" | "auto" };
type: "text" | "image_url";
text?: string;
image_url?: {
url: string;
detail?: "low" | "high" | "auto";
};
}
)[];

Expand Down