@gradio/core 1.0.0-dev.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/dist/src/Blocks.svelte +19 -3
- package/dist/src/Blocks.svelte.d.ts +2 -1
- package/dist/src/api_docs/ApiDocs.svelte +19 -2
- package/dist/src/api_docs/ApiDocs.svelte.d.ts +1 -0
- package/dist/src/api_docs/ApiRecorder.svelte +0 -3
- package/dist/src/api_docs/CodeSnippet.svelte +63 -19
- package/dist/src/api_docs/CodeSnippet.svelte.d.ts +2 -1
- package/dist/src/api_docs/EndpointDetail.svelte +73 -17
- package/dist/src/api_docs/EndpointDetail.svelte.d.ts +3 -0
- package/dist/src/api_docs/MCPSnippet.svelte +21 -28
- package/dist/src/api_docs/MCPSnippet.svelte.d.ts +1 -0
- package/dist/src/api_docs/PercentileChart.svelte +125 -0
- package/dist/src/api_docs/PercentileChart.svelte.d.ts +22 -0
- package/dist/src/dependency.d.ts +4 -1
- package/dist/src/dependency.js +33 -18
- package/dist/src/types.d.ts +1 -0
- package/package.json +60 -61
- package/src/Blocks.svelte +19 -3
- package/src/api_docs/ApiDocs.svelte +19 -2
- package/src/api_docs/ApiRecorder.svelte +0 -3
- package/src/api_docs/CodeSnippet.svelte +63 -19
- package/src/api_docs/EndpointDetail.svelte +73 -17
- package/src/api_docs/MCPSnippet.svelte +21 -28
- package/src/api_docs/PercentileChart.svelte +125 -0
- package/src/dependency.ts +78 -49
- package/src/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
# @gradio/core
|
|
2
|
+
## 1.0.0
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix browser component tests
|
|
7
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix Walkthrough component
|
|
8
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Pass component props as input
|
|
9
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Rename show_api
|
|
10
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Copy as markdown button in API docs
|
|
11
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Deprecate sketch
|
|
12
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Remove SSE transport from MCP docs
|
|
13
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Be able to update visibility programmatically
|
|
14
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix Reload Mode in 6.0
|
|
15
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix render status
|
|
16
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix statustracker for generating outputs
|
|
17
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - clean up some console logs
|
|
18
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - S5 df take3
|
|
19
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix status tracker iterative image
|
|
20
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix show_progress not being respected
|
|
21
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Api docs bug fix and some enhancements to the page
|
|
22
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix textbox updates
|
|
23
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Ensure `show_error` is always respected
|
|
24
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - fix: Using root instead of mcp_server_url for file upload config docs
|
|
25
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix Chatbot autoscroll
|
|
26
|
+
- [#12438](https://github.com/gradio-app/gradio/pull/12438) [`25ffc03`](https://github.com/gradio-app/gradio/commit/25ffc0398f8feb43d817c02b2ab970c16de6d797) - Svelte5 migration and bugfix
|
|
27
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix vibe editor on 6.0
|
|
28
|
+
|
|
29
|
+
### Fixes
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fixed several hardcoded UI labels in the chat_interface that did not implement i18n.
|
|
2
33
|
|
|
3
34
|
## 1.0.0-dev.3
|
|
4
35
|
|
package/dist/src/Blocks.svelte
CHANGED
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
search_params,
|
|
68
68
|
render_complete = false,
|
|
69
69
|
ready = $bindable(false),
|
|
70
|
-
reload_count = $bindable(0)
|
|
70
|
+
reload_count = $bindable(0),
|
|
71
|
+
add_new_message = $bindable()
|
|
71
72
|
}: {
|
|
72
73
|
root: string;
|
|
73
74
|
components: ComponentMeta[];
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
render_complete: boolean;
|
|
96
97
|
ready: boolean;
|
|
97
98
|
reload_count: number;
|
|
99
|
+
add_new_message: (title: string, message: string, type: string) => void;
|
|
98
100
|
} = $props();
|
|
99
101
|
|
|
100
102
|
components.forEach((comp) => {
|
|
@@ -173,11 +175,14 @@
|
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
let api_calls: Payload[] = $state([]);
|
|
178
|
+
let last_api_call: Payload | null = $state(null);
|
|
176
179
|
// We need a callback to add to api_calls from the DependencyManager
|
|
177
180
|
// We can't update a state variable from inside the DependencyManager because
|
|
178
181
|
// svelte won't see it and won't update the UI.
|
|
179
182
|
let add_to_api_calls = (payload: Payload): void => {
|
|
180
|
-
|
|
183
|
+
last_api_call = payload;
|
|
184
|
+
if (!api_recorder_visible) return;
|
|
185
|
+
api_calls = [...api_calls, last_api_call];
|
|
181
186
|
};
|
|
182
187
|
|
|
183
188
|
let dep_manager = new DependencyManager(
|
|
@@ -228,7 +233,7 @@
|
|
|
228
233
|
let ApiDocs: ComponentType<ApiDocsInterface> | null = null;
|
|
229
234
|
let ApiRecorder: ComponentType<ApiRecorderInterface> | null = null;
|
|
230
235
|
let Settings: ComponentType<SettingsInterface> | null = null;
|
|
231
|
-
let VibeEditor:
|
|
236
|
+
let VibeEditor: any = $state(null);
|
|
232
237
|
|
|
233
238
|
async function loadApiDocs(): Promise<void> {
|
|
234
239
|
if (!ApiDocs || !ApiRecorder) {
|
|
@@ -312,6 +317,8 @@
|
|
|
312
317
|
});
|
|
313
318
|
}
|
|
314
319
|
|
|
320
|
+
add_new_message = new_message;
|
|
321
|
+
|
|
315
322
|
let _error_id = -1;
|
|
316
323
|
|
|
317
324
|
const MESSAGE_QUOTE_RE = /^'([^]+)'$/;
|
|
@@ -387,6 +394,10 @@
|
|
|
387
394
|
dep_manager.dispatch_load_events();
|
|
388
395
|
});
|
|
389
396
|
|
|
397
|
+
if (vibe_mode) {
|
|
398
|
+
void loadVibeEditor();
|
|
399
|
+
}
|
|
400
|
+
|
|
390
401
|
return () => {
|
|
391
402
|
mut.disconnect();
|
|
392
403
|
res.disconnect();
|
|
@@ -520,6 +531,7 @@
|
|
|
520
531
|
{space_id}
|
|
521
532
|
{api_calls}
|
|
522
533
|
{username}
|
|
534
|
+
{last_api_call}
|
|
523
535
|
/>
|
|
524
536
|
</div>
|
|
525
537
|
</div>
|
|
@@ -554,6 +566,10 @@
|
|
|
554
566
|
</div>
|
|
555
567
|
</div>
|
|
556
568
|
{/if}
|
|
569
|
+
|
|
570
|
+
{#if vibe_mode && VibeEditor}
|
|
571
|
+
<svelte:component this={VibeEditor} {app} {root} />
|
|
572
|
+
{/if}
|
|
557
573
|
</div>
|
|
558
574
|
|
|
559
575
|
{#if messages}
|
|
@@ -28,7 +28,8 @@ type $$ComponentProps = {
|
|
|
28
28
|
render_complete: boolean;
|
|
29
29
|
ready: boolean;
|
|
30
30
|
reload_count: number;
|
|
31
|
+
add_new_message: (title: string, message: string, type: string) => void;
|
|
31
32
|
};
|
|
32
|
-
declare const Blocks: import("svelte").Component<$$ComponentProps, {}, "ready" | "reload_count">;
|
|
33
|
+
declare const Blocks: import("svelte").Component<$$ComponentProps, {}, "ready" | "reload_count" | "add_new_message">;
|
|
33
34
|
type Blocks = ReturnType<typeof Blocks>;
|
|
34
35
|
export default Blocks;
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
export let space_id: string | null;
|
|
30
30
|
export let root_node: ComponentMeta;
|
|
31
31
|
export let username: string | null;
|
|
32
|
+
export let last_api_call: Payload | null = null;
|
|
32
33
|
|
|
33
34
|
const js_docs =
|
|
34
35
|
"https://www.gradio.app/guides/getting-started-with-the-js-client";
|
|
@@ -54,6 +55,20 @@
|
|
|
54
55
|
export let api_calls: Payload[] = [];
|
|
55
56
|
let current_language: "python" | "javascript" | "bash" | "mcp" = "python";
|
|
56
57
|
|
|
58
|
+
$: sorted_dependencies = (() => {
|
|
59
|
+
const valid = dependencies.filter(
|
|
60
|
+
(dep) =>
|
|
61
|
+
dep.api_visibility === "public" &&
|
|
62
|
+
info?.named_endpoints?.["/" + dep.api_name]
|
|
63
|
+
);
|
|
64
|
+
if (info && last_api_call) {
|
|
65
|
+
const mostRecent = valid.find((dep) => dep.id === last_api_call.fn_index);
|
|
66
|
+
const others = valid.filter((dep) => dep.id !== last_api_call.fn_index);
|
|
67
|
+
return mostRecent ? [mostRecent, ...others] : valid;
|
|
68
|
+
}
|
|
69
|
+
return valid;
|
|
70
|
+
})();
|
|
71
|
+
|
|
57
72
|
function set_query_param(key: string, value: string) {
|
|
58
73
|
const url = new URL(window.location.href);
|
|
59
74
|
url.searchParams.set(key, value);
|
|
@@ -407,6 +422,7 @@
|
|
|
407
422
|
{file_data_present}
|
|
408
423
|
{mcp_docs}
|
|
409
424
|
{analytics}
|
|
425
|
+
{root}
|
|
410
426
|
bind:config_snippets
|
|
411
427
|
/>
|
|
412
428
|
</div>
|
|
@@ -465,8 +481,8 @@
|
|
|
465
481
|
{/if}
|
|
466
482
|
|
|
467
483
|
<div class:hidden={current_language === "mcp"}>
|
|
468
|
-
{#each
|
|
469
|
-
{#if
|
|
484
|
+
{#each sorted_dependencies as dependency}
|
|
485
|
+
{#if info.named_endpoints["/" + dependency.api_name]}
|
|
470
486
|
<div class="endpoint-container">
|
|
471
487
|
<CodeSnippet
|
|
472
488
|
endpoint_parameters={info.named_endpoints[
|
|
@@ -482,6 +498,7 @@
|
|
|
482
498
|
"/" + dependency.api_name
|
|
483
499
|
].description}
|
|
484
500
|
{analytics}
|
|
501
|
+
{last_api_call}
|
|
485
502
|
bind:markdown_code_snippets
|
|
486
503
|
/>
|
|
487
504
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ComponentMeta, Dependency } from "../types";
|
|
2
|
+
import type { ComponentMeta, Dependency, Payload } from "../types";
|
|
3
3
|
import CopyButton from "./CopyButton.svelte";
|
|
4
4
|
import { represent_value, is_potentially_nested_file_data } from "./utils";
|
|
5
5
|
import { Block } from "@gradio/atoms";
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
export let api_description: string | null = null;
|
|
25
25
|
export let analytics: Record<string, any>;
|
|
26
26
|
export let markdown_code_snippets: Record<string, Record<string, string>>;
|
|
27
|
+
export let last_api_call: Payload | null = null;
|
|
27
28
|
|
|
28
29
|
let python_code: HTMLElement;
|
|
29
30
|
let js_code: HTMLElement;
|
|
@@ -41,6 +42,27 @@
|
|
|
41
42
|
$: normalised_api_prefix = api_prefix ? api_prefix : "/";
|
|
42
43
|
$: normalised_root = root.replace(/\/$/, "");
|
|
43
44
|
|
|
45
|
+
$: is_most_recently_used = last_api_call?.fn_index === dependency.id;
|
|
46
|
+
|
|
47
|
+
$: actual_data =
|
|
48
|
+
is_most_recently_used && last_api_call?.data
|
|
49
|
+
? last_api_call.data.filter((d) => typeof d !== "undefined")
|
|
50
|
+
: null;
|
|
51
|
+
|
|
52
|
+
function getParameterValue(param: any, index: number): any {
|
|
53
|
+
if (
|
|
54
|
+
is_most_recently_used &&
|
|
55
|
+
actual_data &&
|
|
56
|
+
actual_data[index] !== undefined
|
|
57
|
+
) {
|
|
58
|
+
return actual_data[index];
|
|
59
|
+
}
|
|
60
|
+
return param.parameter_has_default !== undefined &&
|
|
61
|
+
param.parameter_has_default
|
|
62
|
+
? param.parameter_default
|
|
63
|
+
: param.example_input;
|
|
64
|
+
}
|
|
65
|
+
|
|
44
66
|
$: markdown_code_snippets[
|
|
45
67
|
dependency.api_name as keyof typeof markdown_code_snippets
|
|
46
68
|
] = {
|
|
@@ -55,6 +77,8 @@
|
|
|
55
77
|
api_name={dependency.api_name}
|
|
56
78
|
description={api_description}
|
|
57
79
|
{analytics}
|
|
80
|
+
{last_api_call}
|
|
81
|
+
dependency_id={dependency.id}
|
|
58
82
|
/>
|
|
59
83
|
<div class:hidden={current_language !== "python"}>
|
|
60
84
|
<Block>
|
|
@@ -71,14 +95,16 @@ client = Client(<span class="token string">"{space_id || root}"</span
|
|
|
71
95
|
>{#if username !== null}, auth=("{username}", **password**){/if})
|
|
72
96
|
result = client.<span class="highlight">predict</span
|
|
73
97
|
>(<!--
|
|
74
|
-
-->{#each endpoint_parameters as
|
|
98
|
+
-->{#each endpoint_parameters as param, i}<!--
|
|
75
99
|
-->
|
|
76
|
-
{parameter_name
|
|
77
|
-
? parameter_name + "="
|
|
100
|
+
{param.parameter_name
|
|
101
|
+
? param.parameter_name + "="
|
|
78
102
|
: ""}<span
|
|
103
|
+
class:recent-value={is_most_recently_used &&
|
|
104
|
+
actual_data?.[i] !== undefined}
|
|
79
105
|
>{represent_value(
|
|
80
|
-
|
|
81
|
-
python_type.type,
|
|
106
|
+
getParameterValue(param, i),
|
|
107
|
+
param.python_type.type,
|
|
82
108
|
"py"
|
|
83
109
|
)}</span
|
|
84
110
|
>,{/each}<!--
|
|
@@ -112,22 +138,26 @@ result = client.<span class="highlight">predict</span
|
|
|
112
138
|
const result = await client.predict(<span class="api-name"
|
|
113
139
|
>"/{dependency.api_name}"</span
|
|
114
140
|
>, { <!--
|
|
115
|
-
-->{#each endpoint_parameters as
|
|
116
|
-
-->{#if blob_components.includes(component)}<!--
|
|
141
|
+
-->{#each endpoint_parameters as param, i}<!--
|
|
142
|
+
-->{#if blob_components.includes(param.component)}<!--
|
|
117
143
|
-->
|
|
118
144
|
<span
|
|
119
145
|
class="example-inputs"
|
|
120
|
-
>{parameter_name}: example{component}</span
|
|
146
|
+
>{param.parameter_name}: example{param.component}</span
|
|
121
147
|
>, <!--
|
|
122
148
|
--><span class="desc"><!--
|
|
123
149
|
--></span
|
|
124
150
|
><!--
|
|
125
151
|
-->{:else}<!--
|
|
126
152
|
-->
|
|
127
|
-
<span
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
153
|
+
<span
|
|
154
|
+
class="example-inputs {is_most_recently_used &&
|
|
155
|
+
actual_data?.[i] !== undefined
|
|
156
|
+
? 'recent-value'
|
|
157
|
+
: ''}"
|
|
158
|
+
>{param.parameter_name}: {represent_value(
|
|
159
|
+
getParameterValue(param, i),
|
|
160
|
+
param.python_type.type,
|
|
131
161
|
"js"
|
|
132
162
|
)}</span
|
|
133
163
|
>, <!--
|
|
@@ -151,13 +181,18 @@ result = client.<span class="highlight">predict</span
|
|
|
151
181
|
|
|
152
182
|
<div bind:this={bash_post_code}>
|
|
153
183
|
<pre>curl -X POST {normalised_root}{normalised_api_prefix}/call/{dependency.api_name} -s -H "Content-Type: application/json" -d '{"{"}
|
|
154
|
-
"data": [{#each endpoint_parameters as
|
|
184
|
+
"data": [{#each endpoint_parameters as param, i}
|
|
155
185
|
<!--
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
186
|
+
--><span
|
|
187
|
+
class={is_most_recently_used && actual_data?.[i] !== undefined
|
|
188
|
+
? "recent-value"
|
|
189
|
+
: ""}
|
|
190
|
+
>{represent_value(
|
|
191
|
+
getParameterValue(param, i),
|
|
192
|
+
param.python_type.type,
|
|
193
|
+
"bash"
|
|
194
|
+
)}</span
|
|
195
|
+
>{#if i < endpoint_parameters.length - 1},
|
|
161
196
|
{/if}
|
|
162
197
|
{/each}
|
|
163
198
|
]{"}"}' \
|
|
@@ -211,6 +246,15 @@ result = client.<span class="highlight">predict</span
|
|
|
211
246
|
color: var(--color-accent);
|
|
212
247
|
}
|
|
213
248
|
|
|
249
|
+
.recent-value {
|
|
250
|
+
color: #fd7b00;
|
|
251
|
+
background: #fff4e6;
|
|
252
|
+
border: 1px solid #ffd9b3;
|
|
253
|
+
border-radius: var(--radius-sm);
|
|
254
|
+
padding: 1px 4px;
|
|
255
|
+
font-weight: var(--weight-medium);
|
|
256
|
+
}
|
|
257
|
+
|
|
214
258
|
.hidden {
|
|
215
259
|
display: none;
|
|
216
260
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Dependency } from "../types";
|
|
1
|
+
import type { Dependency, Payload } from "../types";
|
|
2
2
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
3
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
4
|
$$bindings?: Bindings;
|
|
@@ -23,6 +23,7 @@ declare const CodeSnippet: $$__sveltets_2_IsomorphicComponent<{
|
|
|
23
23
|
api_description?: string | null;
|
|
24
24
|
analytics: Record<string, any>;
|
|
25
25
|
markdown_code_snippets: Record<string, Record<string, string>>;
|
|
26
|
+
last_api_call?: Payload | null;
|
|
26
27
|
}, {
|
|
27
28
|
[evt: string]: CustomEvent<any>;
|
|
28
29
|
}, {}, {}, string>;
|
|
@@ -1,30 +1,45 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { Payload } from "../types";
|
|
2
3
|
export let api_name: string | null = null;
|
|
3
4
|
export let description: string | null = null;
|
|
4
5
|
export let analytics: Record<string, any>;
|
|
6
|
+
export let last_api_call: Payload | null = null;
|
|
7
|
+
export let dependency_id: number | null = null;
|
|
5
8
|
import { format_latency, get_color_from_success_rate } from "./utils";
|
|
9
|
+
import PercentileChart from "./PercentileChart.svelte";
|
|
6
10
|
|
|
7
11
|
const success_rate = api_name ? analytics[api_name]?.success_rate : 0;
|
|
8
12
|
const color = get_color_from_success_rate(success_rate);
|
|
13
|
+
$: is_most_recently_used = last_api_call?.fn_index === dependency_id;
|
|
9
14
|
</script>
|
|
10
15
|
|
|
11
16
|
<h3>
|
|
12
17
|
API name:
|
|
13
18
|
<span class="post">{"/" + api_name}</span>
|
|
14
|
-
<span class="desc">
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
<span class="desc">
|
|
20
|
+
{description}
|
|
21
|
+
{#if analytics && api_name && analytics[api_name]}
|
|
22
|
+
{@const endpoint_analytics = analytics[api_name]}
|
|
23
|
+
{@const p50 = endpoint_analytics.process_time_percentiles["50th"]}
|
|
24
|
+
{@const p90 = endpoint_analytics.process_time_percentiles["90th"]}
|
|
25
|
+
{@const p99 = endpoint_analytics.process_time_percentiles["99th"]}
|
|
26
|
+
<span class="analytics-inline">
|
|
27
|
+
<span class="analytics-content">
|
|
28
|
+
<span class="analytics-text-wrapper">
|
|
29
|
+
{endpoint_analytics.total_requests} requests ({Math.round(
|
|
30
|
+
success_rate * 100
|
|
31
|
+
)}% successful, p50: {format_latency(p50)})
|
|
32
|
+
</span>
|
|
33
|
+
<div class="analytics-tooltip">
|
|
34
|
+
<PercentileChart {p50} {p90} {p99} />
|
|
35
|
+
</div>
|
|
36
|
+
</span>
|
|
37
|
+
{#if is_most_recently_used}
|
|
38
|
+
<span class="most-recently-used">Most recently used</span>
|
|
39
|
+
{/if}
|
|
40
|
+
</span>
|
|
41
|
+
{/if}
|
|
42
|
+
</span>
|
|
28
43
|
</h3>
|
|
29
44
|
|
|
30
45
|
<style>
|
|
@@ -46,14 +61,55 @@
|
|
|
46
61
|
font-weight: var(--weight-semibold);
|
|
47
62
|
}
|
|
48
63
|
|
|
49
|
-
.analytics {
|
|
64
|
+
.analytics-inline {
|
|
65
|
+
display: inline-flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: var(--size-2);
|
|
68
|
+
margin-left: var(--size-2);
|
|
50
69
|
color: var(--body-text-color-subdued);
|
|
51
|
-
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.analytics-content {
|
|
73
|
+
position: relative;
|
|
74
|
+
display: inline-block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.analytics-text-wrapper {
|
|
78
|
+
cursor: help;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.analytics-tooltip {
|
|
82
|
+
position: absolute;
|
|
83
|
+
bottom: 100%;
|
|
84
|
+
left: 50%;
|
|
85
|
+
transform: translateX(-50%);
|
|
86
|
+
margin-bottom: var(--size-2);
|
|
87
|
+
opacity: 0;
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
transition: opacity 0.2s ease;
|
|
90
|
+
z-index: 1000;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.analytics-content:hover .analytics-tooltip {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
pointer-events: auto;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.most-recently-used {
|
|
99
|
+
display: inline-block;
|
|
100
|
+
color: #fd7b00;
|
|
101
|
+
background: #fff4e6;
|
|
102
|
+
border: 1px solid #ffd9b3;
|
|
103
|
+
border-radius: var(--radius-sm);
|
|
104
|
+
padding: var(--size-1) var(--size-2);
|
|
105
|
+
font-size: var(--text-sm);
|
|
106
|
+
font-weight: var(--weight-medium);
|
|
107
|
+
white-space: nowrap;
|
|
52
108
|
}
|
|
53
109
|
|
|
54
110
|
.desc {
|
|
55
111
|
color: var(--body-text-color);
|
|
56
112
|
font-size: var(--text-lg);
|
|
57
|
-
margin-
|
|
113
|
+
margin-left: var(--size-2);
|
|
58
114
|
}
|
|
59
115
|
</style>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Payload } from "../types";
|
|
1
2
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
3
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
4
|
$$bindings?: Bindings;
|
|
@@ -15,6 +16,8 @@ declare const EndpointDetail: $$__sveltets_2_IsomorphicComponent<{
|
|
|
15
16
|
api_name?: string | null;
|
|
16
17
|
description?: string | null;
|
|
17
18
|
analytics: Record<string, any>;
|
|
19
|
+
last_api_call?: Payload | null;
|
|
20
|
+
dependency_id?: number | null;
|
|
18
21
|
}, {
|
|
19
22
|
[evt: string]: CustomEvent<any>;
|
|
20
23
|
}, {}, {}, string>;
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
import CopyButton from "./CopyButton.svelte";
|
|
4
4
|
import { Tool, Prompt, Resource } from "@gradio/icons";
|
|
5
5
|
import { format_latency, get_color_from_success_rate } from "./utils";
|
|
6
|
+
import PercentileChart from "./PercentileChart.svelte";
|
|
6
7
|
|
|
7
8
|
export let mcp_server_active: boolean;
|
|
8
9
|
export let mcp_server_url_streamable: string;
|
|
10
|
+
export let root: string;
|
|
9
11
|
export let tools: Tool[];
|
|
10
12
|
export let all_tools: Tool[] = [];
|
|
11
13
|
export let selected_tools: Set<string> = new Set();
|
|
@@ -69,7 +71,7 @@
|
|
|
69
71
|
"gradio[mcp]",
|
|
70
72
|
"gradio",
|
|
71
73
|
"upload-mcp",
|
|
72
|
-
|
|
74
|
+
root,
|
|
73
75
|
"<UPLOAD_DIRECTORY>"
|
|
74
76
|
]
|
|
75
77
|
};
|
|
@@ -218,34 +220,19 @@
|
|
|
218
220
|
: "⚠︎ No description provided in function docstring"}
|
|
219
221
|
</span>
|
|
220
222
|
{#if analytics[tool.meta.endpoint_name]}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
>({Math.round(success_rate * 100)}% successful)</span
|
|
223
|
+
{@const endpoint_analytics = analytics[tool.meta.endpoint_name]}
|
|
224
|
+
{@const p50 =
|
|
225
|
+
endpoint_analytics.process_time_percentiles["50th"]}
|
|
226
|
+
<div class="tool-analytics-wrapper" style="margin-left: 1em;">
|
|
227
|
+
<span
|
|
228
|
+
class="tool-analytics"
|
|
229
|
+
style="color: var(--body-text-color-subdued);"
|
|
229
230
|
>
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
)}
|
|
236
|
-
/
|
|
237
|
-
{format_latency(
|
|
238
|
-
analytics[tool.meta.endpoint_name].process_time_percentiles[
|
|
239
|
-
"90th"
|
|
240
|
-
]
|
|
241
|
-
)}
|
|
242
|
-
/
|
|
243
|
-
{format_latency(
|
|
244
|
-
analytics[tool.meta.endpoint_name].process_time_percentiles[
|
|
245
|
-
"99th"
|
|
246
|
-
]
|
|
247
|
-
)}
|
|
248
|
-
</span>
|
|
231
|
+
{endpoint_analytics.total_requests} requests ({Math.round(
|
|
232
|
+
success_rate * 100
|
|
233
|
+
)}% successful, p50: {format_latency(p50)})
|
|
234
|
+
</span>
|
|
235
|
+
</div>
|
|
249
236
|
{/if}
|
|
250
237
|
</span>
|
|
251
238
|
<span class="tool-arrow">{tool.expanded ? "▼" : "▶"}</span>
|
|
@@ -354,10 +341,16 @@
|
|
|
354
341
|
{/if}
|
|
355
342
|
|
|
356
343
|
<style>
|
|
344
|
+
.tool-analytics-wrapper {
|
|
345
|
+
position: relative;
|
|
346
|
+
display: inline-block;
|
|
347
|
+
}
|
|
348
|
+
|
|
357
349
|
.tool-analytics {
|
|
358
350
|
font-size: 0.95em;
|
|
359
351
|
color: var(--body-text-color-subdued);
|
|
360
352
|
}
|
|
353
|
+
|
|
361
354
|
.transport-selection {
|
|
362
355
|
margin-bottom: var(--size-4);
|
|
363
356
|
}
|
|
@@ -14,6 +14,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
14
14
|
declare const MCPSnippet: $$__sveltets_2_IsomorphicComponent<{
|
|
15
15
|
mcp_server_active: boolean;
|
|
16
16
|
mcp_server_url_streamable: string;
|
|
17
|
+
root: string;
|
|
17
18
|
tools: {
|
|
18
19
|
name: string;
|
|
19
20
|
description: string;
|