Skip to content

Commit

Permalink
Fix reload mode and streaming in 5.0 dev (#9269)
Browse files Browse the repository at this point in the history
* Fix reload mode + streaming

* use api_prefix for reload

* add changeset

* comments

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
freddyaboulton and gradio-pr-bot authored Sep 5, 2024
1 parent fe06141 commit e05f568
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/calm-planets-send.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@gradio/core": minor
"@self/spa": minor
"gradio": minor
---

feat:Fix reload mode and streaming in 5.0 dev
4 changes: 2 additions & 2 deletions js/core/src/Blocks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
) {
await app.post_data(
// @ts-ignore
`${app.config.root}/stream/${submit_map.get(dep_index).event_id()}`,
`${app.config.root + app.config.api_prefix}/stream/${submit_map.get(dep_index).event_id()}`,
{ ...payload, session_hash: app.session_hash }
);
return;
Expand Down Expand Up @@ -596,7 +596,7 @@
if (submit_map.has(dep_id)) {
app.post_data(
// @ts-ignore
`${app.config.root}/stream/${submit_map.get(dep_id).event_id()}/close`,
`${app.config.root + app.config.api_prefix}/stream/${submit_map.get(dep_id).event_id()}/close`,
{}
);
}
Expand Down
2 changes: 1 addition & 1 deletion js/spa/src/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
if (config.dev_mode) {
setTimeout(() => {
const { host } = new URL(api_url);
let url = new URL(`http://${host}/dev/reload`);
let url = new URL(`http://${host}${app.api_prefix}/dev/reload`);
stream = new EventSource(url);
stream.addEventListener("error", async (e) => {
new_message_fn("Error reloading app", "error");
Expand Down

0 comments on commit e05f568

Please sign in to comment.