forked from Nutlope/roomGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
applied a migration, changed some other things
- Loading branch information
Showing
6 changed files
with
83 additions
and
4 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
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,37 @@ | ||
import type { NextApiRequest, NextApiResponse } from "next"; | ||
|
||
export type GenerateResponseData = { | ||
original: string | null; | ||
generated: string | null; | ||
id: string; | ||
}; | ||
|
||
interface ExtendedNextApiRequest extends NextApiRequest { | ||
body: { | ||
imageUrl: string; | ||
theme: string; | ||
room: string; | ||
}; | ||
} | ||
|
||
export default async function handler( | ||
req: ExtendedNextApiRequest, | ||
res: NextApiResponse<GenerateResponseData | string> | ||
) { | ||
// POST request to Replicate to start the image restoration generation process | ||
let predictonResponse = await fetch( | ||
"https://api.replicate.com/v1/predictions/tfda4hdsgncrpafun4ikywjbve", | ||
{ | ||
method: "GET", | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: "Token " + process.env.REPLICATE_API_KEY, | ||
}, | ||
} | ||
); | ||
|
||
let jsonStartResponse = await predictonResponse.json(); | ||
|
||
console.log({ jsonStartResponse }); | ||
res.status(200).json(jsonStartResponse); | ||
} |
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,23 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ADD COLUMN "boughtCredits" INTEGER NOT NULL DEFAULT 0, | ||
ADD COLUMN "credits" INTEGER NOT NULL DEFAULT 5; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Room" ( | ||
"id" TEXT NOT NULL, | ||
"replicateId" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"inputImage" TEXT NOT NULL, | ||
"outputImage" TEXT NOT NULL, | ||
"prompt" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Room_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Room_replicateId_userId_key" ON "Room"("replicateId", "userId"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Room" ADD CONSTRAINT "Room_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.