Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| // Require authentication if enabled | ||
| try { | ||
| if (USE_AUTH) { | ||
| await authCheck(); |
There was a problem hiding this comment.
we shouldn't use server actions in api route context. As an example of how to use auth within an API route, see how its done in copilot response api:
https://github.com/rowboatlabs/rowboat/blob/main/apps/rowboat/app/api/copilot-stream-response/%5BstreamId%5D/route.ts#L11
| const baseKey = `uploaded_images/${dirA}/${dirB}/${id}`; | ||
|
|
||
| // Try known extensions in order | ||
| const exts = ['.png', '.jpg', '.webp', '.bin']; |
There was a problem hiding this comment.
can we get rid of this logic and have the image extension be a part of id?
| // Accepts an image file (multipart/form-data, field name: "file") | ||
| // Stores it either in S3 (if configured) under uploaded_images/<a>/<b>/<uuid>.<ext> | ||
| // or in the in-memory temp cache. Returns a JSON with a URL that the agent can fetch. | ||
| export async function POST(request: NextRequest) { |
There was a problem hiding this comment.
Assuming we get a presigned upload url from s3, why do we need this route to exist at all? Wouldn't the frontend directly upload to the presigned url?
| @@ -0,0 +1,57 @@ | |||
| import { NextRequest, NextResponse } from 'next/server'; | |||
There was a problem hiding this comment.
this should not exist as an API route, but instead as a server action
103a404 to
476654a
Compare
No description provided.