Spaces:
Paused
Paused
Julian Bilcke
commited on
Commit
·
5d1cac2
1
Parent(s):
39166f8
ok, let's remove even more logs
Browse files- src/index.mts +9 -7
src/index.mts
CHANGED
|
@@ -63,10 +63,12 @@ app.post("/analyze", async (req, res) => {
|
|
| 63 |
return
|
| 64 |
}
|
| 65 |
|
|
|
|
| 66 |
console.log("/analyze called with: ", {
|
| 67 |
prompt: request.prompt,
|
| 68 |
image: request.image.slice(0, 50)
|
| 69 |
})
|
|
|
|
| 70 |
|
| 71 |
const response: ImageAnalysisResponse = {
|
| 72 |
result: "",
|
|
@@ -161,21 +163,21 @@ app.post("/render", async (req, res) => {
|
|
| 161 |
}
|
| 162 |
|
| 163 |
if (request.cache === "use") {
|
| 164 |
-
console.log("client requested to use the cache")
|
| 165 |
try {
|
| 166 |
const cached = await loadRenderedSceneFromCache(request)
|
| 167 |
const cachedJson = JSON.stringify(cached)
|
| 168 |
-
console.log(`request ${request} is in cache!`)
|
| 169 |
res.status(200)
|
| 170 |
res.write(cachedJson)
|
| 171 |
res.end()
|
| 172 |
return
|
| 173 |
} catch (err) {
|
| 174 |
-
console.log("request not found in cache: "+ err)
|
| 175 |
// move along
|
| 176 |
}
|
| 177 |
} else if (request.cache === "renew") {
|
| 178 |
-
console.log("client requested to renew the cache")
|
| 179 |
}
|
| 180 |
|
| 181 |
let response: RenderedScene = {
|
|
@@ -196,7 +198,7 @@ app.post("/render", async (req, res) => {
|
|
| 196 |
}
|
| 197 |
|
| 198 |
if (response.error === "already rendering") {
|
| 199 |
-
console.log("server busy")
|
| 200 |
res.status(200)
|
| 201 |
res.write(JSON.stringify(response))
|
| 202 |
res.end()
|
|
@@ -233,7 +235,7 @@ app.get("/render/:renderId", async (req, res) => {
|
|
| 233 |
// we still try to search for it in the cache
|
| 234 |
const cached = await loadRenderedSceneFromCache(undefined, renderId)
|
| 235 |
const cachedJson = JSON.stringify(cached)
|
| 236 |
-
console.log(`request ${renderId} is already in cache, so we return that`)
|
| 237 |
res.status(200)
|
| 238 |
res.write(cachedJson)
|
| 239 |
res.end()
|
|
@@ -306,7 +308,7 @@ app.post("/:ownerId", async (req, res) => {
|
|
| 306 |
let video: Video = null
|
| 307 |
|
| 308 |
console.log(`creating video from request..`)
|
| 309 |
-
console.log(`request: `, JSON.stringify(request))
|
| 310 |
if (!request?.prompt?.length) {
|
| 311 |
console.error(`failed to create video (prompt is empty})`)
|
| 312 |
res.status(400)
|
|
|
|
| 63 |
return
|
| 64 |
}
|
| 65 |
|
| 66 |
+
/*
|
| 67 |
console.log("/analyze called with: ", {
|
| 68 |
prompt: request.prompt,
|
| 69 |
image: request.image.slice(0, 50)
|
| 70 |
})
|
| 71 |
+
*/
|
| 72 |
|
| 73 |
const response: ImageAnalysisResponse = {
|
| 74 |
result: "",
|
|
|
|
| 163 |
}
|
| 164 |
|
| 165 |
if (request.cache === "use") {
|
| 166 |
+
// console.log("client requested to use the cache")
|
| 167 |
try {
|
| 168 |
const cached = await loadRenderedSceneFromCache(request)
|
| 169 |
const cachedJson = JSON.stringify(cached)
|
| 170 |
+
// console.log(`request ${request} is in cache!`)
|
| 171 |
res.status(200)
|
| 172 |
res.write(cachedJson)
|
| 173 |
res.end()
|
| 174 |
return
|
| 175 |
} catch (err) {
|
| 176 |
+
// console.log("request not found in cache: "+ err)
|
| 177 |
// move along
|
| 178 |
}
|
| 179 |
} else if (request.cache === "renew") {
|
| 180 |
+
// console.log("client requested to renew the cache")
|
| 181 |
}
|
| 182 |
|
| 183 |
let response: RenderedScene = {
|
|
|
|
| 198 |
}
|
| 199 |
|
| 200 |
if (response.error === "already rendering") {
|
| 201 |
+
// console.log("server busy")
|
| 202 |
res.status(200)
|
| 203 |
res.write(JSON.stringify(response))
|
| 204 |
res.end()
|
|
|
|
| 235 |
// we still try to search for it in the cache
|
| 236 |
const cached = await loadRenderedSceneFromCache(undefined, renderId)
|
| 237 |
const cachedJson = JSON.stringify(cached)
|
| 238 |
+
// console.log(`request ${renderId} is already in cache, so we return that`)
|
| 239 |
res.status(200)
|
| 240 |
res.write(cachedJson)
|
| 241 |
res.end()
|
|
|
|
| 308 |
let video: Video = null
|
| 309 |
|
| 310 |
console.log(`creating video from request..`)
|
| 311 |
+
// console.log(`request: `, JSON.stringify(request))
|
| 312 |
if (!request?.prompt?.length) {
|
| 313 |
console.error(`failed to create video (prompt is empty})`)
|
| 314 |
res.status(400)
|