feat(web): add modal serverless type (preview)

This commit is contained in:
BennyKok
2024-01-02 13:55:49 +08:00
parent 61498dd3f5
commit 46869e78b1
5 changed files with 706 additions and 0 deletions
+21
View File
@@ -115,6 +115,27 @@ export const createRun = withServerPromise(
try {
switch (machine.type) {
case "modal-serverless":
const _data = {
input: {
...shareData,
prompt_id: prompt_id,
},
};
const ___result = await fetch(`${machine.endpoint}/run`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(_data),
cache: "no-store",
});
console.log(___result);
if (!___result.ok)
throw new Error(`Error creating run, ${___result.statusText}`);
console.log(_data, ___result);
break;
case "runpod-serverless":
const data = {
input: {