Squashed commit of the following:

commit c36b0ec0b374dd8ccbee3a6044ee7e3f1fefe368
Author: Nicholas Koben Kao <[email protected]>
Date:   Thu Jan 25 17:54:54 2024 -0800

    nits on wording and removing link to broken storage/:id page

commit 0777fdcf7b0002244bc713199d3d64eea6b6061e
Author: Nicholas Koben Kao <[email protected]>
Date:   Thu Jan 25 17:23:55 2024 -0800

    builder update config and such

commit 958b795bb2b6ac27ce33c5729ef265b068420e1a
Author: Nicholas Koben Kao <[email protected]>
Date:   Thu Jan 25 17:23:43 2024 -0800

    rename all from checkponit to model

commit 7a9c5636e73bd005499b141a4dd382db5672c962
Author: Nicholas Koben Kao <[email protected]>
Date:   Thu Jan 25 16:51:59 2024 -0800

    rename for consistency

commit 48bebbafab9a95388817df97c15f8ea97e0fea75
Author: Nicholas Koben Kao <[email protected]>
Date:   Thu Jan 25 16:18:36 2024 -0800

    bulider

commit 81dacd9af457886f2f027994d225a7748c738abb
Author: Nicholas Koben Kao <[email protected]>
Date:   Thu Jan 25 16:17:56 2024 -0800

    different types of models
This commit is contained in:
bennykok
2024-01-26 10:08:37 +08:00
parent 62a69dba06
commit 85477aba9d
22 changed files with 2919 additions and 235 deletions
+11 -11
View File
@@ -1,15 +1,15 @@
import { parseDataSafe } from "../../../../lib/parseDataSafe";
import { db } from "@/db/db";
import { checkpointTable, machinesTable } from "@/db/schema";
import { modelTable } from "@/db/schema";
import { eq } from "drizzle-orm";
import { NextResponse } from "next/server";
import { z } from "zod";
const Request = z.object({
volume_id: z.string(),
checkpoint_id: z.string(),
model_id: z.string(),
folder_path: z.string().optional(),
status: z.enum(['success', 'failed']),
status: z.enum(["success", "failed"]),
error_log: z.string().optional(),
timeout: z.number().optional(),
});
@@ -18,30 +18,30 @@ export async function POST(request: Request) {
const [data, error] = await parseDataSafe(Request, request);
if (!data || error) return error;
const { checkpoint_id, error_log, status, folder_path } = data;
console.log( checkpoint_id, error_log, status, folder_path )
const { model_id, error_log, status, folder_path } = data;
console.log(model_id, error_log, status, folder_path);
if (status === "success") {
await db
.update(checkpointTable)
.update(modelTable)
.set({
status: "success",
folder_path,
updated_at: new Date(),
// build_log: build_log,
})
.where(eq(checkpointTable.id, checkpoint_id));
.where(eq(modelTable.id, model_id));
} else {
await db
.update(checkpointTable)
.update(modelTable)
.set({
status: "failed",
error_log,
error_log,
updated_at: new Date(),
// status: "error",
// build_log: build_log,
})
.where(eq(checkpointTable.id, checkpoint_id));
.where(eq(modelTable.id, model_id));
}
return NextResponse.json(
@@ -50,6 +50,6 @@ export async function POST(request: Request) {
},
{
status: 200,
}
},
);
}
+8 -8
View File
@@ -1,14 +1,14 @@
import { setInitialUserData } from "../../../lib/setInitialUserData";
import { auth } from "@clerk/nextjs";
import { clerkClient } from "@clerk/nextjs/server";
import { CheckpointList } from "@/components/CheckpointList";
import { getAllUserCheckpoints } from "@/server/getAllUserCheckpoints";
import { ModelList } from "@/components/ModelList";
import { getAllUserModels } from "@/server/getAllUserModel";
export default function Page() {
return <CheckpointListServer />;
return <ModelListServer />;
}
async function CheckpointListServer() {
async function ModelListServer() {
const { userId } = auth();
if (!userId) {
@@ -21,15 +21,15 @@ async function CheckpointListServer() {
await setInitialUserData(userId);
}
const checkpoints = await getAllUserCheckpoints();
const models = await getAllUserModels();
if (!checkpoints) {
return <div>No checkpoints found</div>;
if (!models) {
return <div>No models found</div>;
}
return (
<div className="w-full">
<CheckpointList data={checkpoints} />
<ModelList data={models} />
</div>
);
}