fix: prompt error

This commit is contained in:
bennykok
2024-06-11 17:43:02 -07:00
parent 04fd08d5ba
commit 62df715655
2 changed files with 33 additions and 6 deletions
+6 -4
View File
@@ -25,8 +25,10 @@ import struct
from logging import basicConfig, getLogger
import logfire
if os.environ.get('LOGFIRE_TOKEN', None) is not None:
logfire.configure()
# if os.environ.get('LOGFIRE_TOKEN', None) is not None:
logfire.configure(
send_to_logfire="if-token-present"
)
# basicConfig(handlers=[logfire.LogfireLoggingHandler()])
logfire_handler = logfire.LogfireLoggingHandler()
logger = getLogger("comfy-deploy")
@@ -323,7 +325,7 @@ async def stream_prompt(data):
# When there are critical errors, the prompt is actually not run
await update_run(prompt_id, Status.FAILED)
# return web.Response(status=500, reason=f"{error_type}: {e}, {stack_trace_short}")
raise Exception("Prompt failed")
# raise Exception("Prompt failed")
status = 200
@@ -339,7 +341,7 @@ async def stream_prompt(data):
# When there are critical errors, the prompt is actually not run
if "error" in res:
await update_run(prompt_id, Status.FAILED)
raise Exception("Prompt failed")
# raise Exception("Prompt failed")
return res
# return web.json_response(res, status=status)
+27 -2
View File
@@ -15,7 +15,32 @@ function sendEventToCD(event, data) {
function dispatchAPIEventData(data) {
const msg = JSON.parse(data);
// Custom parse error
if (msg.error) {
let message = msg.error.message;
if (msg.error.details)
message += ": " + msg.error.details;
for (const [nodeID, nodeError] of Object.entries(
msg.node_errors,
)) {
message += "\n" + nodeError.class_type + ":";
for (const errorReason of nodeError.errors) {
message +=
"\n - " + errorReason.message + ": " + errorReason.details;
}
}
app.ui.dialog.show(message);
if (error.response) {
app.lastNodeErrors = msg.node_errors;
app.canvas.draw(true, true);
}
}
switch (msg.event) {
case "error":
break;
case "status":
if (msg.data.sid) {
// this.clientId = msg.data.sid;
@@ -52,8 +77,8 @@ function dispatchAPIEventData(data) {
break;
default:
api.dispatchEvent(new CustomEvent(msg.type, { detail: msg.data }));
// default:
// if (this.#registered.has(msg.type)) {
// default:
// if (this.#registered.has(msg.type)) {
// } else {
// throw new Error(`Unknown message type ${msg.type}`);
// }