Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix frontend errors on ApiDocs and RecordingSnippet #9786

Merged
merged 3 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/late-candies-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@gradio/core": minor
"gradio": minor
---

feat:Fix frontend errors on ApiDocs and RecordingSnippet
2 changes: 1 addition & 1 deletion js/core/src/Blocks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@
on:close={(event) => {
set_api_docs_visible(false);
api_calls = [];
api_recorder_visible = event.detail.api_recorder_visible;
api_recorder_visible = event.detail?.api_recorder_visible;
}}
{dependencies}
{root}
Expand Down
1 change: 1 addition & 0 deletions js/core/src/api_docs/ApiDocs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
{api_calls}
{dependencies}
{root}
api_prefix={app.api_prefix}
short_root={space_id || root}
{username}
/>
Expand Down
8 changes: 5 additions & 3 deletions js/core/src/api_docs/RecordingSnippet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
export let dependencies: Dependency[];
export let short_root: string;
export let root: string;
export let api_prefix = "";
export let current_language: "python" | "javascript" | "bash";
export let username: string | null;

Expand All @@ -22,7 +23,9 @@
named_endpoints: any;
unnamed_endpoints: any;
}> {
let response = await fetch(root + "info/?all_endpoints=true");
let response = await fetch(
root.replace(/\/$/, "") + api_prefix + "/info/?all_endpoints=true"
);
let data = await response.json();
return data;
}
Expand Down Expand Up @@ -160,8 +163,7 @@ const app = await Client.connect(<span class="token string">"{short_root}"</span
await client.predict(<span
class="api-name">
"/{api_name}"</span
>{#if call},
{/if}{call});
>{#if call}, {call}{/if});
{/each}</pre>
</div>
</code>
Expand Down
Loading