-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eric
committed
Apr 29, 2023
1 parent
ae04c21
commit e69933f
Showing
2 changed files
with
27 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction | ||
import { Midjourney } from "midjourney"; | ||
import type { NextApiRequest, NextApiResponse } from "next"; | ||
import { ResponseError } from "../../interfaces"; | ||
import { Readable } from "stream"; | ||
const client = new Midjourney( | ||
<string>process.env.SERVER_ID, | ||
<string>process.env.CHANNEL_ID, | ||
<string>process.env.SALAI_TOKEN | ||
); | ||
export default async function handler( | ||
req: NextApiRequest, | ||
res: NextApiResponse | ||
) { | ||
const { prompt } = req.body; | ||
const stream = new Readable({ | ||
read() { | ||
this.push("hello"); | ||
setTimeout(() => { | ||
this.push("world"); | ||
this.push(null); | ||
}, 1000); | ||
}, | ||
}); | ||
stream.pipe(res); | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
e69933f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
midjourney-ui – ./
midjourney-ui-erictik.vercel.app
midjourney-ui-git-main-erictik.vercel.app
midjourney.baochi.xin
midjourney-ui.vercel.app