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
+32 -3
View File
@@ -1,4 +1,5 @@
import { z } from "zod";
import { TypeOf, z } from "zod";
import { modelEnumType } from "@/db/schema";
// from chatgpt https://chat.openai.com/share/4985d20b-30b1-4a28-87f6-6ebf84a1040e
@@ -110,12 +111,21 @@ export const statsSchema = z.object({
tippedAmountCount: z.number(),
});
const civitaiModelType = z.enum([
"Checkpoint",
"TextualInversion",
"Hypernetwork",
"AestheticGradient",
"LORA",
"Controlnet",
"Poses",
]);
export const CivitaiModelResponse = z.object({
id: z.number(),
name: z.string().nullish(),
description: z.string().nullish(),
// type: z.enum(["Checkpoint", "Lora"]), // TODO: this will be important to know
type: z.string(),
type: civitaiModelType,
poi: z.boolean().nullish(),
nsfw: z.boolean().nullish(),
allowNoCredit: z.boolean().nullish(),
@@ -127,3 +137,22 @@ export const CivitaiModelResponse = z.object({
tags: z.array(z.string()).nullish(),
modelVersions: z.array(modelVersionSchema),
});
export function getModelTypeDetails(
modelType: typeof civitaiModelType["_type"],
): modelEnumType | undefined {
switch (modelType) {
case "Checkpoint":
return "checkpoint"
case "TextualInversion":
return "embedding"
case "LORA":
return "lora"
case "AestheticGradient":
case "Hypernetwork":
case "Controlnet":
case "Poses":
default:
return undefined;
}
}