@gradio/core 0.27.0 → 0.27.1
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 +11 -0
- package/dist/src/Blocks.svelte +12 -21
- package/dist/src/Blocks.svelte.d.ts +11 -9
- package/dist/src/Embed.svelte.d.ts +4 -2
- package/dist/src/Login.svelte.d.ts +2 -0
- package/dist/src/MountComponents.svelte.d.ts +3 -1
- package/dist/src/Render.svelte +12 -13
- package/dist/src/Render.svelte.d.ts +3 -1
- package/dist/src/RenderComponent.svelte +3 -6
- package/dist/src/RenderComponent.svelte.d.ts +2 -0
- package/dist/src/api_docs/ApiBanner.svelte.d.ts +3 -1
- package/dist/src/api_docs/ApiDocs.svelte +10 -15
- package/dist/src/api_docs/ApiDocs.svelte.d.ts +3 -1
- package/dist/src/api_docs/ApiRecorder.svelte.d.ts +3 -1
- package/dist/src/api_docs/CodeSnippet.svelte +2 -4
- package/dist/src/api_docs/CodeSnippet.svelte.d.ts +3 -1
- package/dist/src/api_docs/CopyButton.svelte.d.ts +2 -0
- package/dist/src/api_docs/EndpointDetail.svelte.d.ts +4 -2
- package/dist/src/api_docs/InputPayload.svelte.d.ts +2 -0
- package/dist/src/api_docs/InstallSnippet.svelte.d.ts +2 -0
- package/dist/src/api_docs/MCPSnippet.svelte +50 -44
- package/dist/src/api_docs/MCPSnippet.svelte.d.ts +4 -2
- package/dist/src/api_docs/NoApi.svelte.d.ts +2 -0
- package/dist/src/api_docs/ParametersSnippet.svelte.d.ts +2 -0
- package/dist/src/api_docs/RecordingSnippet.svelte.d.ts +4 -2
- package/dist/src/api_docs/ResponseSnippet.svelte.d.ts +2 -0
- package/dist/src/api_docs/Settings.svelte.d.ts +4 -2
- package/dist/src/api_docs/SettingsBanner.svelte.d.ts +2 -0
- package/dist/src/api_docs/TryButton.svelte.d.ts +2 -0
- package/dist/src/api_docs/img/clear.svelte.d.ts +2 -0
- package/dist/src/stories/I18nMultiLanguageTestComponent.svelte.d.ts +3 -3
- package/dist/src/stories/I18nTestSetup.svelte +1 -2
- package/dist/src/stories/I18nTestSetup.svelte.d.ts +3 -1
- package/package.json +20 -20
- package/src/api_docs/MCPSnippet.svelte +28 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @gradio/core
|
|
2
2
|
|
|
3
|
+
## 0.27.1
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- [#11767](https://github.com/gradio-app/gradio/pull/11767) [`f67faa4`](https://github.com/gradio-app/gradio/commit/f67faa464add0ef6a4a58d60eb2ae850125ebb87) - Use icons instead of Emojis in MCP page. Thanks @freddyaboulton!
|
|
8
|
+
|
|
9
|
+
### Dependency updates
|
|
10
|
+
|
|
11
|
+
- @gradio/icons@0.13.1
|
|
12
|
+
- @gradio/upload@0.16.16
|
|
13
|
+
|
|
3
14
|
## 0.27.0
|
|
4
15
|
|
|
5
16
|
### Features
|
package/dist/src/Blocks.svelte
CHANGED
|
@@ -53,17 +53,15 @@ let {
|
|
|
53
53
|
} = create_components({
|
|
54
54
|
initial_layout
|
|
55
55
|
});
|
|
56
|
-
$:
|
|
57
|
-
components, layout, dependencies, root, app, fill_height, target, run();
|
|
56
|
+
$: components, layout, dependencies, root, app, fill_height, target, run();
|
|
58
57
|
$: {
|
|
59
58
|
ready = !!$_layout;
|
|
60
59
|
}
|
|
61
60
|
let old_dependencies = dependencies;
|
|
62
|
-
$:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
61
|
+
$: if (dependencies !== old_dependencies && render_complete && !layout_creating) {
|
|
62
|
+
handle_load_triggers();
|
|
63
|
+
old_dependencies = dependencies;
|
|
64
|
+
}
|
|
67
65
|
let vibe_editor_width = 350;
|
|
68
66
|
async function run() {
|
|
69
67
|
await setupi18n(app.config?.i18n_translations || void 0);
|
|
@@ -94,10 +92,8 @@ async function loadApiDocs() {
|
|
|
94
92
|
if (!ApiDocs || !ApiRecorder) {
|
|
95
93
|
const api_docs_module = await import("./api_docs/ApiDocs.svelte");
|
|
96
94
|
const api_recorder_module = await import("./api_docs/ApiRecorder.svelte");
|
|
97
|
-
if (!ApiDocs)
|
|
98
|
-
|
|
99
|
-
if (!ApiRecorder)
|
|
100
|
-
ApiRecorder = api_recorder_module.default;
|
|
95
|
+
if (!ApiDocs) ApiDocs = api_docs_module.default;
|
|
96
|
+
if (!ApiRecorder) ApiRecorder = api_recorder_module.default;
|
|
101
97
|
}
|
|
102
98
|
}
|
|
103
99
|
async function loadApiRecorder() {
|
|
@@ -405,8 +401,7 @@ async function trigger_api_call(dep_index, trigger_id = null, event_data = null)
|
|
|
405
401
|
);
|
|
406
402
|
} catch (e) {
|
|
407
403
|
const fn_index = 0;
|
|
408
|
-
if (app.closed)
|
|
409
|
-
return;
|
|
404
|
+
if (app.closed) return;
|
|
410
405
|
messages = [
|
|
411
406
|
new_message("Error", String(e), fn_index, "error"),
|
|
412
407
|
...messages
|
|
@@ -637,11 +632,9 @@ async function handle_mount() {
|
|
|
637
632
|
a[i].setAttribute("target", "_blank");
|
|
638
633
|
}
|
|
639
634
|
handle_load_triggers();
|
|
640
|
-
if (!target || render_complete)
|
|
641
|
-
return;
|
|
635
|
+
if (!target || render_complete) return;
|
|
642
636
|
target.addEventListener("prop_change", (e) => {
|
|
643
|
-
if (!isCustomEvent(e))
|
|
644
|
-
throw new Error("not a custom event");
|
|
637
|
+
if (!isCustomEvent(e)) throw new Error("not a custom event");
|
|
645
638
|
const { id, prop, value } = e.detail;
|
|
646
639
|
update_value([{ id, prop, value }]);
|
|
647
640
|
if (prop === "input_ready" && value === false) {
|
|
@@ -652,8 +645,7 @@ async function handle_mount() {
|
|
|
652
645
|
}
|
|
653
646
|
});
|
|
654
647
|
target.addEventListener("gradio", (e) => {
|
|
655
|
-
if (!isCustomEvent(e))
|
|
656
|
-
throw new Error("not a custom event");
|
|
648
|
+
if (!isCustomEvent(e)) throw new Error("not a custom event");
|
|
657
649
|
const { id, event, data } = e.detail;
|
|
658
650
|
if (event === "share") {
|
|
659
651
|
const { title: title2, description } = data;
|
|
@@ -701,8 +693,7 @@ const handle_load_triggers = () => {
|
|
|
701
693
|
}
|
|
702
694
|
});
|
|
703
695
|
};
|
|
704
|
-
$:
|
|
705
|
-
set_status($loading_status);
|
|
696
|
+
$: set_status($loading_status);
|
|
706
697
|
function update_status(id, status, data) {
|
|
707
698
|
data.status = status;
|
|
708
699
|
update_value([
|
|
@@ -9,34 +9,36 @@ declare const __propDef: {
|
|
|
9
9
|
components: ComponentMeta[];
|
|
10
10
|
layout: LayoutNode;
|
|
11
11
|
dependencies: Dependency[];
|
|
12
|
-
title?: string
|
|
12
|
+
title?: string;
|
|
13
13
|
target: HTMLElement;
|
|
14
14
|
autoscroll: boolean;
|
|
15
|
-
show_api?: boolean
|
|
16
|
-
show_footer?: boolean
|
|
17
|
-
control_page_title?: boolean
|
|
15
|
+
show_api?: boolean;
|
|
16
|
+
show_footer?: boolean;
|
|
17
|
+
control_page_title?: boolean;
|
|
18
18
|
app_mode: boolean;
|
|
19
19
|
theme_mode: ThemeMode;
|
|
20
20
|
app: Awaited<ReturnType<typeof Client.connect>>;
|
|
21
21
|
space_id: string | null;
|
|
22
22
|
version: string;
|
|
23
23
|
js: string | null;
|
|
24
|
-
fill_height?: boolean
|
|
24
|
+
fill_height?: boolean;
|
|
25
25
|
ready: boolean;
|
|
26
26
|
username: string | null;
|
|
27
|
-
api_prefix?: string
|
|
27
|
+
api_prefix?: string;
|
|
28
28
|
max_file_size?: number | undefined;
|
|
29
29
|
initial_layout?: ComponentMeta | undefined;
|
|
30
30
|
css?: string | null | undefined;
|
|
31
|
-
vibe_mode?: boolean
|
|
31
|
+
vibe_mode?: boolean;
|
|
32
32
|
search_params: URLSearchParams;
|
|
33
|
-
render_complete?: boolean
|
|
34
|
-
add_new_message?: (
|
|
33
|
+
render_complete?: boolean;
|
|
34
|
+
add_new_message?: (title: string, message: string, type: ToastMessage["type"]) => void;
|
|
35
35
|
};
|
|
36
36
|
events: {
|
|
37
37
|
[evt: string]: CustomEvent<any>;
|
|
38
38
|
};
|
|
39
39
|
slots: {};
|
|
40
|
+
exports?: {} | undefined;
|
|
41
|
+
bindings?: string | undefined;
|
|
40
42
|
};
|
|
41
43
|
export type BlocksProps = typeof __propDef.props;
|
|
42
44
|
export type BlocksEvents = typeof __propDef.events;
|
|
@@ -11,8 +11,8 @@ declare const __propDef: {
|
|
|
11
11
|
display: boolean;
|
|
12
12
|
info: boolean;
|
|
13
13
|
loaded: boolean;
|
|
14
|
-
pages?: [string, string][]
|
|
15
|
-
current_page?: string
|
|
14
|
+
pages?: [string, string][];
|
|
15
|
+
current_page?: string;
|
|
16
16
|
root: string;
|
|
17
17
|
};
|
|
18
18
|
events: {
|
|
@@ -21,6 +21,8 @@ declare const __propDef: {
|
|
|
21
21
|
slots: {
|
|
22
22
|
default: {};
|
|
23
23
|
};
|
|
24
|
+
exports?: {} | undefined;
|
|
25
|
+
bindings?: string | undefined;
|
|
24
26
|
};
|
|
25
27
|
export type EmbedProps = typeof __propDef.props;
|
|
26
28
|
export type EmbedEvents = typeof __propDef.events;
|
|
@@ -8,7 +8,7 @@ declare const __propDef: {
|
|
|
8
8
|
theme_mode: any;
|
|
9
9
|
version: any;
|
|
10
10
|
autoscroll: boolean;
|
|
11
|
-
max_file_size?:
|
|
11
|
+
max_file_size?: number | null;
|
|
12
12
|
client: Client;
|
|
13
13
|
};
|
|
14
14
|
events: {
|
|
@@ -17,6 +17,8 @@ declare const __propDef: {
|
|
|
17
17
|
[evt: string]: CustomEvent<any>;
|
|
18
18
|
};
|
|
19
19
|
slots: {};
|
|
20
|
+
exports?: {} | undefined;
|
|
21
|
+
bindings?: string | undefined;
|
|
20
22
|
};
|
|
21
23
|
export type MountComponentsProps = typeof __propDef.props;
|
|
22
24
|
export type MountComponentsEvents = typeof __propDef.events;
|
package/dist/src/Render.svelte
CHANGED
|
@@ -48,19 +48,18 @@ $: {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
$:
|
|
52
|
-
node.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
51
|
+
$: node.props.gradio = new Gradio(
|
|
52
|
+
node.id,
|
|
53
|
+
target,
|
|
54
|
+
theme_mode,
|
|
55
|
+
version,
|
|
56
|
+
root,
|
|
57
|
+
autoscroll,
|
|
58
|
+
max_file_size,
|
|
59
|
+
$reactive_formatter,
|
|
60
|
+
client,
|
|
61
|
+
load_component
|
|
62
|
+
);
|
|
64
63
|
</script>
|
|
65
64
|
|
|
66
65
|
{#if node.component}
|
|
@@ -5,7 +5,7 @@ declare const __propDef: {
|
|
|
5
5
|
props: {
|
|
6
6
|
root: string;
|
|
7
7
|
node: ComponentMeta;
|
|
8
|
-
parent?:
|
|
8
|
+
parent?: string | null;
|
|
9
9
|
target: HTMLElement;
|
|
10
10
|
theme_mode: ThemeMode;
|
|
11
11
|
version: string;
|
|
@@ -20,6 +20,8 @@ declare const __propDef: {
|
|
|
20
20
|
[evt: string]: CustomEvent<any>;
|
|
21
21
|
};
|
|
22
22
|
slots: {};
|
|
23
|
+
exports?: {} | undefined;
|
|
24
|
+
bindings?: string | undefined;
|
|
23
25
|
};
|
|
24
26
|
export type RenderProps = typeof __propDef.props;
|
|
25
27
|
export type RenderEvents = typeof __propDef.events;
|
|
@@ -20,8 +20,7 @@ function wrap(component2) {
|
|
|
20
20
|
const props = Object.keys(instance2.$$.props);
|
|
21
21
|
function report(props2) {
|
|
22
22
|
return function(propargs) {
|
|
23
|
-
if (!target)
|
|
24
|
-
return;
|
|
23
|
+
if (!target) return;
|
|
25
24
|
const ev = s(_id, props2, propargs);
|
|
26
25
|
target.dispatchEvent(ev);
|
|
27
26
|
};
|
|
@@ -50,10 +49,8 @@ function translate_prop(obj) {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
|
-
$:
|
|
54
|
-
|
|
55
|
-
$:
|
|
56
|
-
value = translate_if_needed(value);
|
|
52
|
+
$: translate_prop($$restProps);
|
|
53
|
+
$: value = translate_if_needed(value);
|
|
57
54
|
</script>
|
|
58
55
|
|
|
59
56
|
{#if visible}
|
|
@@ -3,7 +3,7 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
root: string;
|
|
5
5
|
api_count: number;
|
|
6
|
-
current_language?:
|
|
6
|
+
current_language?: "python" | "javascript" | "bash" | "mcp";
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
9
9
|
close: CustomEvent<any>;
|
|
@@ -11,6 +11,8 @@ declare const __propDef: {
|
|
|
11
11
|
[evt: string]: CustomEvent<any>;
|
|
12
12
|
};
|
|
13
13
|
slots: {};
|
|
14
|
+
exports?: {} | undefined;
|
|
15
|
+
bindings?: string | undefined;
|
|
14
16
|
};
|
|
15
17
|
export type ApiBannerProps = typeof __propDef.props;
|
|
16
18
|
export type ApiBannerEvents = typeof __propDef.events;
|
|
@@ -76,22 +76,17 @@ get_js_info().then((js_api_info) => {
|
|
|
76
76
|
js_info = js_api_info;
|
|
77
77
|
});
|
|
78
78
|
const dispatch = createEventDispatcher();
|
|
79
|
-
$:
|
|
80
|
-
|
|
81
|
-
$:
|
|
82
|
-
|
|
83
|
-
$:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (mcp_json_sse && selected_tools.size > 0) {
|
|
89
|
-
const baseUrl = selected_tools_array.length > 0 && selected_tools_array.length < tools.length ? `${root}gradio_api/mcp/sse?tools=${selected_tools_without_prefix.join(",")}` : `${root}gradio_api/mcp/sse`;
|
|
90
|
-
mcp_json_sse.mcpServers.gradio.url = baseUrl;
|
|
91
|
-
if (mcp_json_stdio) {
|
|
92
|
-
mcp_json_stdio.mcpServers.gradio.args[1] = baseUrl;
|
|
93
|
-
}
|
|
79
|
+
$: selected_tools_array = Array.from(selected_tools);
|
|
80
|
+
$: selected_tools_without_prefix = selected_tools_array.map(remove_tool_prefix);
|
|
81
|
+
$: mcp_server_url = `${root}gradio_api/mcp/sse`;
|
|
82
|
+
$: mcp_server_url_streamable = selected_tools_array.length > 0 && selected_tools_array.length < tools.length ? `${root}gradio_api/mcp/?tools=${selected_tools_without_prefix.join(",")}` : `${root}gradio_api/mcp/`;
|
|
83
|
+
$: if (mcp_json_sse && selected_tools.size > 0) {
|
|
84
|
+
const baseUrl = selected_tools_array.length > 0 && selected_tools_array.length < tools.length ? `${root}gradio_api/mcp/sse?tools=${selected_tools_without_prefix.join(",")}` : `${root}gradio_api/mcp/sse`;
|
|
85
|
+
mcp_json_sse.mcpServers.gradio.url = baseUrl;
|
|
86
|
+
if (mcp_json_stdio) {
|
|
87
|
+
mcp_json_stdio.mcpServers.gradio.args[1] = baseUrl;
|
|
94
88
|
}
|
|
89
|
+
}
|
|
95
90
|
let tools = [];
|
|
96
91
|
let headers = [];
|
|
97
92
|
let mcp_json_sse;
|
|
@@ -10,7 +10,7 @@ declare const __propDef: {
|
|
|
10
10
|
space_id: string | null;
|
|
11
11
|
root_node: ComponentMeta;
|
|
12
12
|
username: string | null;
|
|
13
|
-
api_calls?: Payload[]
|
|
13
|
+
api_calls?: Payload[];
|
|
14
14
|
};
|
|
15
15
|
events: {
|
|
16
16
|
close: CustomEvent<any>;
|
|
@@ -18,6 +18,8 @@ declare const __propDef: {
|
|
|
18
18
|
[evt: string]: CustomEvent<any>;
|
|
19
19
|
};
|
|
20
20
|
slots: {};
|
|
21
|
+
exports?: {} | undefined;
|
|
22
|
+
bindings?: string | undefined;
|
|
21
23
|
};
|
|
22
24
|
export type ApiDocsProps = typeof __propDef.props;
|
|
23
25
|
export type ApiDocsEvents = typeof __propDef.events;
|
|
@@ -2,13 +2,15 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import type { Payload, Dependency } from "../types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
api_calls?: Payload[]
|
|
5
|
+
api_calls?: Payload[];
|
|
6
6
|
dependencies: Dependency[];
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
export type ApiRecorderProps = typeof __propDef.props;
|
|
14
16
|
export type ApiRecorderEvents = typeof __propDef.events;
|
|
@@ -21,10 +21,8 @@ let blob_components = ["Audio", "File", "Image", "Video"];
|
|
|
21
21
|
let blob_examples = endpoint_parameters.filter(
|
|
22
22
|
(param) => blob_components.includes(param.component)
|
|
23
23
|
);
|
|
24
|
-
$:
|
|
25
|
-
|
|
26
|
-
$:
|
|
27
|
-
normalised_root = root.replace(/\/$/, "");
|
|
24
|
+
$: normalised_api_prefix = api_prefix ? api_prefix : "/";
|
|
25
|
+
$: normalised_root = root.replace(/\/$/, "");
|
|
28
26
|
</script>
|
|
29
27
|
|
|
30
28
|
<div class="container">
|
|
@@ -9,12 +9,14 @@ declare const __propDef: {
|
|
|
9
9
|
endpoint_parameters: any;
|
|
10
10
|
username: string | null;
|
|
11
11
|
current_language: "python" | "javascript" | "bash";
|
|
12
|
-
api_description?:
|
|
12
|
+
api_description?: string | null;
|
|
13
13
|
};
|
|
14
14
|
events: {
|
|
15
15
|
[evt: string]: CustomEvent<any>;
|
|
16
16
|
};
|
|
17
17
|
slots: {};
|
|
18
|
+
exports?: {} | undefined;
|
|
19
|
+
bindings?: string | undefined;
|
|
18
20
|
};
|
|
19
21
|
export type CodeSnippetProps = typeof __propDef.props;
|
|
20
22
|
export type CodeSnippetEvents = typeof __propDef.events;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
api_name?:
|
|
5
|
-
description?:
|
|
4
|
+
api_name?: string | null;
|
|
5
|
+
description?: string | null;
|
|
6
6
|
};
|
|
7
7
|
events: {
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
9
9
|
};
|
|
10
10
|
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
11
13
|
};
|
|
12
14
|
export type EndpointDetailProps = typeof __propDef.props;
|
|
13
15
|
export type EndpointDetailEvents = typeof __propDef.events;
|
|
@@ -15,6 +15,8 @@ declare const __propDef: {
|
|
|
15
15
|
[evt: string]: CustomEvent<any>;
|
|
16
16
|
};
|
|
17
17
|
slots: {};
|
|
18
|
+
exports?: {} | undefined;
|
|
19
|
+
bindings?: string | undefined;
|
|
18
20
|
};
|
|
19
21
|
export type InputPayloadProps = typeof __propDef.props;
|
|
20
22
|
export type InputPayloadEvents = typeof __propDef.events;
|
|
@@ -7,6 +7,8 @@ declare const __propDef: {
|
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
8
8
|
};
|
|
9
9
|
slots: {};
|
|
10
|
+
exports?: {} | undefined;
|
|
11
|
+
bindings?: string | undefined;
|
|
10
12
|
};
|
|
11
13
|
export type InstallSnippetProps = typeof __propDef.props;
|
|
12
14
|
export type InstallSnippetEvents = typeof __propDef.events;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>import { Block } from "@gradio/atoms";
|
|
2
2
|
import CopyButton from "./CopyButton.svelte";
|
|
3
|
+
import { Tool, Prompt, Resource } from "@gradio/icons";
|
|
3
4
|
export let mcp_server_active;
|
|
4
5
|
export let mcp_server_url;
|
|
5
6
|
export let mcp_server_url_streamable;
|
|
@@ -17,16 +18,14 @@ const transports = [
|
|
|
17
18
|
["sse", "SSE"],
|
|
18
19
|
["stdio", "STDIO"]
|
|
19
20
|
];
|
|
20
|
-
const
|
|
21
|
-
tool:
|
|
22
|
-
resource:
|
|
23
|
-
prompt:
|
|
21
|
+
const tool_type_icons = {
|
|
22
|
+
tool: Tool,
|
|
23
|
+
resource: Resource,
|
|
24
|
+
prompt: Prompt
|
|
24
25
|
};
|
|
25
|
-
$:
|
|
26
|
-
display_url = current_transport === "sse" ? mcp_server_url : mcp_server_url_streamable;
|
|
26
|
+
$: display_url = current_transport === "sse" ? mcp_server_url : mcp_server_url_streamable;
|
|
27
27
|
function update_config_with_file_upload(base_config, include_upload) {
|
|
28
|
-
if (!base_config)
|
|
29
|
-
return null;
|
|
28
|
+
if (!base_config) return null;
|
|
30
29
|
const config = JSON.parse(JSON.stringify(base_config));
|
|
31
30
|
if (include_upload && file_data_present) {
|
|
32
31
|
const upload_file_mcp_server = {
|
|
@@ -46,30 +45,27 @@ function update_config_with_file_upload(base_config, include_upload) {
|
|
|
46
45
|
}
|
|
47
46
|
return config;
|
|
48
47
|
}
|
|
49
|
-
$:
|
|
50
|
-
|
|
51
|
-
mcp_json_sse
|
|
52
|
-
|
|
53
|
-
mcpServers
|
|
54
|
-
|
|
55
|
-
gradio
|
|
56
|
-
|
|
57
|
-
url: mcp_server_url_streamable
|
|
58
|
-
}
|
|
48
|
+
$: mcp_json_streamable_http = update_config_with_file_upload(
|
|
49
|
+
mcp_json_sse ? {
|
|
50
|
+
...mcp_json_sse,
|
|
51
|
+
mcpServers: {
|
|
52
|
+
...mcp_json_sse.mcpServers,
|
|
53
|
+
gradio: {
|
|
54
|
+
...mcp_json_sse.mcpServers.gradio,
|
|
55
|
+
url: mcp_server_url_streamable
|
|
59
56
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
$:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
);
|
|
57
|
+
}
|
|
58
|
+
} : null,
|
|
59
|
+
include_file_upload
|
|
60
|
+
);
|
|
61
|
+
$: mcp_json_sse_updated = update_config_with_file_upload(
|
|
62
|
+
mcp_json_sse,
|
|
63
|
+
include_file_upload
|
|
64
|
+
);
|
|
65
|
+
$: mcp_json_stdio_updated = update_config_with_file_upload(
|
|
66
|
+
mcp_json_stdio,
|
|
67
|
+
include_file_upload
|
|
68
|
+
);
|
|
73
69
|
</script>
|
|
74
70
|
|
|
75
71
|
{#if mcp_server_active}
|
|
@@ -109,11 +105,15 @@ $:
|
|
|
109
105
|
{/if}
|
|
110
106
|
|
|
111
107
|
<div class="tool-selection">
|
|
112
|
-
<strong
|
|
113
|
-
|
|
114
|
-
(
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
<strong>
|
|
109
|
+
{all_tools.length > 0 ? all_tools.length : tools.length} Available MCP Tools
|
|
110
|
+
(<span style="display: inline-block; vertical-align: sub;"><Tool /></span
|
|
111
|
+
>), Resources (<span style="display: inline-block; vertical-align: sub;"
|
|
112
|
+
><Resource /></span
|
|
113
|
+
>), and Prompts (<span style="display: inline-block; vertical-align: sub;"
|
|
114
|
+
><Prompt /></span
|
|
115
|
+
>)
|
|
116
|
+
</strong>
|
|
117
117
|
{#if all_tools.length > 0}
|
|
118
118
|
<div class="tool-selection-controls">
|
|
119
119
|
<button
|
|
@@ -163,17 +163,23 @@ $:
|
|
|
163
163
|
class="tool-header"
|
|
164
164
|
on:click={() => (tool.expanded = !tool.expanded)}
|
|
165
165
|
>
|
|
166
|
-
<span
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
<span style="display: inline-block">
|
|
167
|
+
<span
|
|
168
|
+
style="display: inline-block; padding-right: 6px; vertical-align: sub"
|
|
169
169
|
>
|
|
170
|
+
{#if tool_type_icons[tool.meta.mcp_type]}
|
|
171
|
+
{@const Icon = tool_type_icons[tool.meta.mcp_type]}
|
|
172
|
+
<Icon />
|
|
173
|
+
{/if}
|
|
174
|
+
</span>
|
|
175
|
+
<span class="tool-name">{tool.name}</span>
|
|
170
176
|
|
|
171
|
-
<span class="tool-description"
|
|
172
|
-
|
|
177
|
+
<span class="tool-description">
|
|
178
|
+
{tool.description
|
|
173
179
|
? tool.description
|
|
174
|
-
: "⚠︎ No description provided in function docstring"}
|
|
175
|
-
|
|
176
|
-
>
|
|
180
|
+
: "⚠︎ No description provided in function docstring"}
|
|
181
|
+
</span>
|
|
182
|
+
</span>
|
|
177
183
|
<span class="tool-arrow">{tool.expanded ? "▼" : "▶"}</span>
|
|
178
184
|
</button>
|
|
179
185
|
</div>
|
|
@@ -35,8 +35,8 @@ declare const __propDef: {
|
|
|
35
35
|
mcp_type: "tool" | "resource" | "prompt";
|
|
36
36
|
file_data_present: boolean;
|
|
37
37
|
};
|
|
38
|
-
}[]
|
|
39
|
-
selected_tools?: Set<string
|
|
38
|
+
}[];
|
|
39
|
+
selected_tools?: Set<string>;
|
|
40
40
|
mcp_json_sse: any;
|
|
41
41
|
mcp_json_stdio: any;
|
|
42
42
|
file_data_present: boolean;
|
|
@@ -46,6 +46,8 @@ declare const __propDef: {
|
|
|
46
46
|
[evt: string]: CustomEvent<any>;
|
|
47
47
|
};
|
|
48
48
|
slots: {};
|
|
49
|
+
exports?: {} | undefined;
|
|
50
|
+
bindings?: string | undefined;
|
|
49
51
|
};
|
|
50
52
|
export type McpSnippetProps = typeof __propDef.props;
|
|
51
53
|
export type McpSnippetEvents = typeof __propDef.events;
|
|
@@ -10,6 +10,8 @@ declare const __propDef: {
|
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
13
15
|
};
|
|
14
16
|
export type ParametersSnippetProps = typeof __propDef.props;
|
|
15
17
|
export type ParametersSnippetEvents = typeof __propDef.events;
|
|
@@ -5,15 +5,17 @@ declare const __propDef: {
|
|
|
5
5
|
dependencies: Dependency[];
|
|
6
6
|
short_root: string;
|
|
7
7
|
root: string;
|
|
8
|
-
api_prefix?: string
|
|
8
|
+
api_prefix?: string;
|
|
9
9
|
current_language: "python" | "javascript" | "bash" | "mcp";
|
|
10
10
|
username: string | null;
|
|
11
|
-
api_calls?: Payload[]
|
|
11
|
+
api_calls?: Payload[];
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
14
14
|
[evt: string]: CustomEvent<any>;
|
|
15
15
|
};
|
|
16
16
|
slots: {};
|
|
17
|
+
exports?: {} | undefined;
|
|
18
|
+
bindings?: string | undefined;
|
|
17
19
|
};
|
|
18
20
|
export type RecordingSnippetProps = typeof __propDef.props;
|
|
19
21
|
export type RecordingSnippetEvents = typeof __propDef.events;
|
|
@@ -10,6 +10,8 @@ declare const __propDef: {
|
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
13
15
|
};
|
|
14
16
|
export type ResponseSnippetProps = typeof __propDef.props;
|
|
15
17
|
export type ResponseSnippetEvents = typeof __propDef.events;
|
|
@@ -4,8 +4,8 @@ declare const __propDef: {
|
|
|
4
4
|
root: string;
|
|
5
5
|
space_id: string | null;
|
|
6
6
|
pwa_enabled: boolean | undefined;
|
|
7
|
-
allow_zoom?: boolean
|
|
8
|
-
allow_video_trim?: boolean
|
|
7
|
+
allow_zoom?: boolean;
|
|
8
|
+
allow_video_trim?: boolean;
|
|
9
9
|
};
|
|
10
10
|
events: {
|
|
11
11
|
close: CustomEvent<any>;
|
|
@@ -14,6 +14,8 @@ declare const __propDef: {
|
|
|
14
14
|
[evt: string]: CustomEvent<any>;
|
|
15
15
|
};
|
|
16
16
|
slots: {};
|
|
17
|
+
exports?: {} | undefined;
|
|
18
|
+
bindings?: string | undefined;
|
|
17
19
|
};
|
|
18
20
|
export type SettingsProps = typeof __propDef.props;
|
|
19
21
|
export type SettingsEvents = typeof __propDef.events;
|
|
@@ -9,6 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
export type SettingsBannerProps = typeof __propDef.props;
|
|
14
16
|
export type SettingsBannerEvents = typeof __propDef.events;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
|
-
props:
|
|
4
|
-
[x: string]: never;
|
|
5
|
-
};
|
|
3
|
+
props: Record<string, never>;
|
|
6
4
|
events: {
|
|
7
5
|
[evt: string]: CustomEvent<any>;
|
|
8
6
|
};
|
|
9
7
|
slots: {};
|
|
8
|
+
exports?: {} | undefined;
|
|
9
|
+
bindings?: string | undefined;
|
|
10
10
|
};
|
|
11
11
|
export type I18nMultiLanguageTestComponentProps = typeof __propDef.props;
|
|
12
12
|
export type I18nMultiLanguageTestComponentEvents = typeof __propDef.events;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
active?: boolean
|
|
4
|
+
active?: boolean;
|
|
5
5
|
};
|
|
6
6
|
events: {
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
8
8
|
};
|
|
9
9
|
slots: {};
|
|
10
|
+
exports?: {} | undefined;
|
|
11
|
+
bindings?: string | undefined;
|
|
10
12
|
};
|
|
11
13
|
export type I18nTestSetupProps = typeof __propDef.props;
|
|
12
14
|
export type I18nTestSetupEvents = typeof __propDef.events;
|
package/package.json
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/core",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@gradio/annotatedimage": "^0.9.29",
|
|
7
6
|
"@gradio/accordion": "^0.5.22",
|
|
8
|
-
"@gradio/
|
|
7
|
+
"@gradio/annotatedimage": "^0.9.29",
|
|
9
8
|
"@gradio/atoms": "^0.16.5",
|
|
9
|
+
"@gradio/box": "^0.2.23",
|
|
10
|
+
"@gradio/audio": "^0.17.25",
|
|
10
11
|
"@gradio/browserstate": "^0.3.2",
|
|
12
|
+
"@gradio/button": "^0.5.11",
|
|
11
13
|
"@gradio/chatbot": "^0.26.22",
|
|
12
14
|
"@gradio/checkbox": "^0.4.28",
|
|
13
|
-
"@gradio/box": "^0.2.23",
|
|
14
|
-
"@gradio/button": "^0.5.11",
|
|
15
15
|
"@gradio/checkboxgroup": "^0.6.27",
|
|
16
16
|
"@gradio/client": "^1.17.1",
|
|
17
17
|
"@gradio/code": "^0.14.15",
|
|
18
18
|
"@gradio/colorpicker": "^0.4.27",
|
|
19
19
|
"@gradio/column": "^0.2.1",
|
|
20
|
-
"@gradio/dataframe": "^0.
|
|
21
|
-
"@gradio/dropdown": "^0.10.2",
|
|
20
|
+
"@gradio/dataframe": "^0.19.0",
|
|
22
21
|
"@gradio/dataset": "^0.4.32",
|
|
23
22
|
"@gradio/datetime": "^0.3.20",
|
|
24
23
|
"@gradio/downloadbutton": "^0.4.11",
|
|
25
24
|
"@gradio/fallback": "^0.4.27",
|
|
26
25
|
"@gradio/file": "^0.12.28",
|
|
26
|
+
"@gradio/dropdown": "^0.10.2",
|
|
27
27
|
"@gradio/fileexplorer": "^0.5.39",
|
|
28
28
|
"@gradio/form": "^0.2.23",
|
|
29
|
-
"@gradio/group": "^0.2.0",
|
|
30
29
|
"@gradio/gallery": "^0.15.31",
|
|
30
|
+
"@gradio/group": "^0.2.0",
|
|
31
31
|
"@gradio/highlightedtext": "^0.9.10",
|
|
32
|
-
"@gradio/html": "^0.
|
|
33
|
-
"@gradio/icons": "^0.13.0",
|
|
32
|
+
"@gradio/html": "^0.7.0",
|
|
34
33
|
"@gradio/image": "^0.22.17",
|
|
34
|
+
"@gradio/icons": "^0.13.1",
|
|
35
35
|
"@gradio/imageeditor": "^0.16.5",
|
|
36
|
-
"@gradio/json": "^0.5.29",
|
|
37
36
|
"@gradio/imageslider": "^0.2.13",
|
|
37
|
+
"@gradio/json": "^0.5.29",
|
|
38
38
|
"@gradio/label": "^0.5.19",
|
|
39
39
|
"@gradio/markdown": "^0.13.20",
|
|
40
40
|
"@gradio/model3d": "^0.14.25",
|
|
41
|
-
"@gradio/multimodaltextbox": "^0.10.17",
|
|
42
|
-
"@gradio/number": "^0.6.4",
|
|
43
41
|
"@gradio/nativeplot": "^0.7.4",
|
|
42
|
+
"@gradio/number": "^0.6.4",
|
|
43
|
+
"@gradio/multimodaltextbox": "^0.10.17",
|
|
44
44
|
"@gradio/paramviewer": "^0.7.15",
|
|
45
45
|
"@gradio/plot": "^0.9.22",
|
|
46
46
|
"@gradio/radio": "^0.7.10",
|
|
47
47
|
"@gradio/row": "^0.2.1",
|
|
48
48
|
"@gradio/sidebar": "^0.1.20",
|
|
49
|
+
"@gradio/simpledropdown": "^0.3.27",
|
|
49
50
|
"@gradio/simpleimage": "^0.8.39",
|
|
50
51
|
"@gradio/simpletextbox": "^0.3.28",
|
|
51
|
-
"@gradio/simpledropdown": "^0.3.27",
|
|
52
52
|
"@gradio/sketchbox": "^0.6.15",
|
|
53
|
-
"@gradio/slider": "^0.6.16",
|
|
54
53
|
"@gradio/state": "^0.1.2",
|
|
54
|
+
"@gradio/slider": "^0.6.16",
|
|
55
|
+
"@gradio/statustracker": "^0.10.17",
|
|
55
56
|
"@gradio/tabitem": "^0.5.0",
|
|
56
57
|
"@gradio/tabs": "^0.4.5",
|
|
57
58
|
"@gradio/textbox": "^0.10.20",
|
|
58
|
-
"@gradio/theme": "^0.4.0",
|
|
59
59
|
"@gradio/timer": "^0.4.5",
|
|
60
|
-
"@gradio/
|
|
61
|
-
"@gradio/upload": "^0.16.
|
|
60
|
+
"@gradio/theme": "^0.4.0",
|
|
61
|
+
"@gradio/upload": "^0.16.16",
|
|
62
|
+
"@gradio/vibeeditor": "^0.2.2",
|
|
62
63
|
"@gradio/uploadbutton": "^0.9.11",
|
|
63
|
-
"@gradio/utils": "^0.10.2",
|
|
64
64
|
"@gradio/video": "^0.15.0",
|
|
65
|
-
"@gradio/
|
|
65
|
+
"@gradio/utils": "^0.10.2",
|
|
66
66
|
"@gradio/wasm": "^0.18.1"
|
|
67
67
|
},
|
|
68
68
|
"msw": {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Block } from "@gradio/atoms";
|
|
3
3
|
import CopyButton from "./CopyButton.svelte";
|
|
4
|
+
import { Tool, Prompt, Resource } from "@gradio/icons";
|
|
4
5
|
|
|
5
6
|
export let mcp_server_active: boolean;
|
|
6
7
|
export let mcp_server_url: string;
|
|
@@ -42,10 +43,10 @@
|
|
|
42
43
|
["stdio", "STDIO"]
|
|
43
44
|
] as const;
|
|
44
45
|
|
|
45
|
-
const
|
|
46
|
-
tool:
|
|
47
|
-
resource:
|
|
48
|
-
prompt:
|
|
46
|
+
const tool_type_icons: Record<Tool["meta"]["mcp_type"], typeof Tool> = {
|
|
47
|
+
tool: Tool,
|
|
48
|
+
resource: Resource,
|
|
49
|
+
prompt: Prompt
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
$: display_url =
|
|
@@ -145,11 +146,15 @@
|
|
|
145
146
|
{/if}
|
|
146
147
|
|
|
147
148
|
<div class="tool-selection">
|
|
148
|
-
<strong
|
|
149
|
-
|
|
150
|
-
(
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
<strong>
|
|
150
|
+
{all_tools.length > 0 ? all_tools.length : tools.length} Available MCP Tools
|
|
151
|
+
(<span style="display: inline-block; vertical-align: sub;"><Tool /></span
|
|
152
|
+
>), Resources (<span style="display: inline-block; vertical-align: sub;"
|
|
153
|
+
><Resource /></span
|
|
154
|
+
>), and Prompts (<span style="display: inline-block; vertical-align: sub;"
|
|
155
|
+
><Prompt /></span
|
|
156
|
+
>)
|
|
157
|
+
</strong>
|
|
153
158
|
{#if all_tools.length > 0}
|
|
154
159
|
<div class="tool-selection-controls">
|
|
155
160
|
<button
|
|
@@ -199,17 +204,23 @@
|
|
|
199
204
|
class="tool-header"
|
|
200
205
|
on:click={() => (tool.expanded = !tool.expanded)}
|
|
201
206
|
>
|
|
202
|
-
<span
|
|
203
|
-
|
|
204
|
-
|
|
207
|
+
<span style="display: inline-block">
|
|
208
|
+
<span
|
|
209
|
+
style="display: inline-block; padding-right: 6px; vertical-align: sub"
|
|
205
210
|
>
|
|
211
|
+
{#if tool_type_icons[tool.meta.mcp_type]}
|
|
212
|
+
{@const Icon = tool_type_icons[tool.meta.mcp_type]}
|
|
213
|
+
<Icon />
|
|
214
|
+
{/if}
|
|
215
|
+
</span>
|
|
216
|
+
<span class="tool-name">{tool.name}</span>
|
|
206
217
|
|
|
207
|
-
<span class="tool-description"
|
|
208
|
-
|
|
218
|
+
<span class="tool-description">
|
|
219
|
+
{tool.description
|
|
209
220
|
? tool.description
|
|
210
|
-
: "⚠︎ No description provided in function docstring"}
|
|
211
|
-
|
|
212
|
-
>
|
|
221
|
+
: "⚠︎ No description provided in function docstring"}
|
|
222
|
+
</span>
|
|
223
|
+
</span>
|
|
213
224
|
<span class="tool-arrow">{tool.expanded ? "▼" : "▶"}</span>
|
|
214
225
|
</button>
|
|
215
226
|
</div>
|