clean up web

This commit is contained in:
Nicholas Koben Kao 2024-01-24 22:22:59 -08:00
parent 4c047aea62
commit 0d88907cfd
3 changed files with 3 additions and 7 deletions

View File

@ -78,7 +78,6 @@ export const columns: ColumnDef<CheckpointItemList>[] = [
}, },
cell: ({ row }) => { cell: ({ row }) => {
const checkpoint = row.original; const checkpoint = row.original;
console.log(checkpoint);
return ( return (
<a <a
className="hover:underline flex gap-2" className="hover:underline flex gap-2"
@ -116,6 +115,7 @@ export const columns: ColumnDef<CheckpointItemList>[] = [
{row.original.status} {row.original.status}
</Badge> </Badge>
); );
// NOTE: retry downloads on failures
// const oneHourAgo = new Date(new Date().getTime() - (60 * 60 * 1000)); // const oneHourAgo = new Date(new Date().getTime() - (60 * 60 * 1000));
// const lastUpdated = new Date(row.original.updated_at); // const lastUpdated = new Date(row.original.updated_at);
// const canRefresh = row.original.status === "failed" && lastUpdated < oneHourAgo; // const canRefresh = row.original.status === "failed" && lastUpdated < oneHourAgo;
@ -189,6 +189,7 @@ export const columns: ColumnDef<CheckpointItemList>[] = [
</div> </div>
), ),
}, },
// TODO: deletion and editing for future sprint
// { // {
// id: "actions", // id: "actions",
// enableHiding: false, // enableHiding: false,
@ -274,7 +275,6 @@ export function CheckpointList({ data }: { data: CheckpointItemList[] }) {
fieldConfig={{ fieldConfig={{
civitai_url: { civitai_url: {
fieldType: "fallback", fieldType: "fallback",
// fieldType: "fallback",
inputProps: { required: true }, inputProps: { required: true },
description: ( description: (
<> <>

View File

@ -8,14 +8,12 @@ import {
CheckpointVolumeType, CheckpointVolumeType,
} from "@/db/schema"; } from "@/db/schema";
import { withServerPromise } from "./withServerPromise"; import { withServerPromise } from "./withServerPromise";
import { redirect } from "next/navigation";
import { db } from "@/db/db"; import { db } from "@/db/db";
import type { z } from "zod"; import type { z } from "zod";
import { headers } from "next/headers"; import { headers } from "next/headers";
import { addCivitaiCheckpointSchema } from "./addCheckpointSchema"; import { addCivitaiCheckpointSchema } from "./addCheckpointSchema";
import { and, eq, isNull } from "drizzle-orm"; import { and, eq, isNull } from "drizzle-orm";
import { CivitaiModelResponse } from "@/types/civitai"; import { CivitaiModelResponse } from "@/types/civitai";
import { CheckpointItemList } from "@/components/CheckpointList";
export async function getCheckpoints() { export async function getCheckpoints() {
const { userId, orgId } = auth(); const { userId, orgId } = auth();
@ -121,14 +119,12 @@ export const addCivitaiCheckpoint = withServerPromise(
if (!userId) return { error: "No user id" }; if (!userId) return { error: "No user id" };
const { url, modelVersionId } = getUrl(data?.civitai_url); const { url, modelVersionId } = getUrl(data?.civitai_url);
console.log("4", url, modelVersionId);
const civitaiModelRes = await fetch(url) const civitaiModelRes = await fetch(url)
.then((x) => x.json()) .then((x) => x.json())
.then((a) => { .then((a) => {
console.log(a); console.log(a);
return CivitaiModelResponse.parse(a); return CivitaiModelResponse.parse(a);
}); });
console.log("5");
if (civitaiModelRes?.modelVersions?.length === 0) { if (civitaiModelRes?.modelVersions?.length === 0) {
return; // no versions to download return; // no versions to download

View File

@ -62,7 +62,7 @@ export const imageMetaSchema = z.object({
DenoisingStrength: z.number().nullish(), DenoisingStrength: z.number().nullish(),
}); });
// all over the place // NOTE: this definition is all over the place
// export const imageSchema = z.object({ // export const imageSchema = z.object({
// url: z.string().url().nullish(), // url: z.string().url().nullish(),
// nsfw: z.enum(["None", "Soft", "Mature"]).nullish(), // nsfw: z.enum(["None", "Soft", "Mature"]).nullish(),