Skip to content

Commit

Permalink
Merge branch 'mckaywrigley:main' into org
Browse files Browse the repository at this point in the history
  • Loading branch information
jollytoad authored May 22, 2024
2 parents 2d9f8e8 + d60e1f3 commit 81a3cad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/api/chat/anthropic/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ export async function POST(request: NextRequest) {
return { type: "text", text: content }
} else if (
content?.type === "image_url" &&
content?.image_url?.length
content?.image_url?.url?.length
) {
return {
type: "image",
source: {
type: "base64",
media_type: getMediaTypeFromDataURL(content.image_url),
data: getBase64FromDataURL(content.image_url)
media_type: getMediaTypeFromDataURL(content.image_url.url),
data: getBase64FromDataURL(content.image_url.url)
}
}
} else {
Expand Down
6 changes: 5 additions & 1 deletion app/api/chat/openai/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export async function POST(request: Request) {
model: chatSettings.model as ChatCompletionCreateParamsBase["model"],
messages: messages as ChatCompletionCreateParamsBase["messages"],
temperature: chatSettings.temperature,
max_tokens: chatSettings.model === "gpt-4-vision-preview" ? 4096 : null, // TODO: Fix
max_tokens:
chatSettings.model === "gpt-4-vision-preview" ||
chatSettings.model === "gpt-4o"
? 4096
: null, // TODO: Fix
stream: true
})

Expand Down
4 changes: 3 additions & 1 deletion lib/build-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ export async function buildFinalMessages(

return {
type: "image_url",
image_url: formedUrl
image_url: {
url: formedUrl
}
}
})
]
Expand Down

0 comments on commit 81a3cad

Please sign in to comment.