feat: add gpu options
This commit is contained in:
@@ -11,6 +11,7 @@ export const addMachineSchema = insertMachineSchema.pick({
|
||||
export const insertCustomMachineSchema = createInsertSchema(machinesTable, {
|
||||
name: (schema) => schema.name.default("My Machine"),
|
||||
type: (schema) => schema.type.default("comfy-deploy-serverless"),
|
||||
gpu: (schema) => schema.gpu.default("T4"),
|
||||
snapshot: (schema) =>
|
||||
schema.snapshot.default({
|
||||
comfyui: "d0165d819afe76bd4e6bdd710eb5f3e571b6a804",
|
||||
@@ -37,4 +38,5 @@ export const addCustomMachineSchema = insertCustomMachineSchema.pick({
|
||||
type: true,
|
||||
snapshot: true,
|
||||
models: true,
|
||||
gpu: true,
|
||||
});
|
||||
|
||||
@@ -93,6 +93,7 @@ export const updateCustomMachine = withServerPromise(
|
||||
JSON.stringify(data.snapshot) !== JSON.stringify(currentMachine.snapshot);
|
||||
const modelsChanged =
|
||||
JSON.stringify(data.models) !== JSON.stringify(currentMachine.models);
|
||||
const gpuChanged = data.gpu !== currentMachine.gpu;
|
||||
|
||||
// return {
|
||||
// message: `snapshotChanged: ${snapshotChanged}, modelsChanged: ${modelsChanged}`,
|
||||
@@ -101,7 +102,7 @@ export const updateCustomMachine = withServerPromise(
|
||||
await db.update(machinesTable).set(data).where(eq(machinesTable.id, id));
|
||||
|
||||
// If there are changes
|
||||
if (snapshotChanged || modelsChanged) {
|
||||
if (snapshotChanged || modelsChanged || gpuChanged) {
|
||||
// Update status to building
|
||||
await db
|
||||
.update(machinesTable)
|
||||
@@ -174,7 +175,7 @@ async function buildMachine(
|
||||
snapshot: data.snapshot, //JSON.parse( as string),
|
||||
callback_url: `${protocol}://${domain}/api/machine-built`,
|
||||
models: data.models, //JSON.parse(data.models as string),
|
||||
gpu: "T4",
|
||||
gpu: data.gpu ?? "T4",
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user