Ensure error modal display as expected when using the queue (#4273)

This commit is contained in:
pngwn 2023-05-20 00:32:12 +01:00 committed by GitHub
parent 834afdd303
commit 1d0f0a9db0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 16 deletions

View File

@ -0,0 +1,5 @@
---
"@gradio/client": patch
---
Ensure websocket error messages are correctly handled.

View File

@ -8,6 +8,7 @@ No changes to highlight.
- Fixed Gallery/AnnotatedImage components resaving identical images by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4256](https://github.com/gradio-app/gradio/pull/4256)
- Fixed Audio/Video/File components creating empty tempfiles on each run by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4256](https://github.com/gradio-app/gradio/pull/4256)
- Fixed the behavior of the `run_on_click` parameter in `gr.Examples` by [@abidlabs](https://github.com/abidlabs) in [PR 4258](https://github.com/gradio-app/gradio/pull/4258).
- Ensure error modal displays when the queue is enabled by [@pngwn](https://github.com/pngwn) in [PR 4273](https://github.com/gradio-app/gradio/pull/4273)
- Ensure js client respcts the full root when making requests to the server by [@pngwn](https://github.com/pngwn) in [PR 4271](https://github.com/gradio-app/gradio/pull/4271)
## Other Changes:

View File

@ -399,7 +399,7 @@ export async function client(
type: "data",
endpoint: _endpoint,
fn_index,
data: output.data,
data: data,
time: new Date()
});
@ -1226,18 +1226,32 @@ function handle_message(
data: data.success ? data.output : null
};
case "process_completed":
return {
type: "complete",
status: {
queue,
message: !data.success ? data.output.error : undefined,
stage: data.success ? "complete" : "error",
code: data.code,
progress_data: data.progress_data,
eta: data.output.average_duration
},
data: data.success ? data.output : null
};
if ("error" in data.output) {
return {
type: "update",
status: {
queue,
message: data.output.error as string,
stage: "error",
code: data.code,
success: data.success
}
};
} else {
return {
type: "complete",
status: {
queue,
message: !data.success ? data.output.error : undefined,
stage: data.success ? "complete" : "error",
code: data.code,
progress_data: data.progress_data,
eta: data.output.average_duration
},
data: data.success ? data.output : null
};
}
case "process_starts":
return {
type: "update",

View File

@ -3,8 +3,8 @@
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite --port 3001 -c",
"build": "vite build -c",
"dev": "vite --port 3001",
"build": "vite build",
"preview": "vite preview --port 3001"
},
"devDependencies": {

View File

@ -10,7 +10,7 @@
"build:cdn": "pnpm --filter @gradio/client build && pnpm --filter @gradio/app build:cdn --emptyOutDir",
"build:website": "pnpm --filter @gradio/app build:website --emptyOutDir",
"build:cdn-local": "TEST_CDN=TRUE pnpm build:cdn",
"preview:cdn-server": "sirv ../gradio/templates/cdn --single --port=4321 --cors",
"preview:cdn-server": "sirv ./gradio/templates/cdn --single --port=4321 --cors",
"preview:cdn-app": "pnpm --filter @gradio/cdn-test dev",
"preview:cdn-local": "run-p preview:cdn-server preview:cdn-app",
"format:check": "prettier --ignore-path .config/.prettierignore --check --plugin-search-dir=. .",