@gradio/client 1.17.1 → 1.19.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 +17 -0
- package/dist/browser.js +332 -341
- package/dist/helpers/init_helpers.d.ts.map +1 -1
- package/dist/index.js +37 -60
- package/dist/types.d.ts +7 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/submit.d.ts.map +1 -1
- package/dist/{wrapper-CviSselG.js → wrapper-CpGUsf_3.js} +172 -795
- package/package.json +1 -1
- package/src/helpers/init_helpers.ts +0 -8
- package/src/test/init_helpers.test.ts +0 -10
- package/src/types.ts +8 -2
- package/src/utils/submit.ts +14 -2
package/package.json
CHANGED
|
@@ -202,14 +202,6 @@ export function determine_protocol(endpoint: string): {
|
|
|
202
202
|
http_protocol: protocol as "http:" | "https:",
|
|
203
203
|
host: host + (pathname !== "/" ? pathname : "")
|
|
204
204
|
};
|
|
205
|
-
} else if (endpoint.startsWith("file:")) {
|
|
206
|
-
// This case is only expected to be used for the Wasm mode (Gradio-lite),
|
|
207
|
-
// where users can create a local HTML file using it and open the page in a browser directly via the `file:` protocol.
|
|
208
|
-
return {
|
|
209
|
-
ws_protocol: "ws",
|
|
210
|
-
http_protocol: "http:",
|
|
211
|
-
host: "lite.local" // Special fake hostname only used for this case. This matches the hostname allowed in `is_self_host()` in `js/wasm/network/host.ts`.
|
|
212
|
-
};
|
|
213
205
|
}
|
|
214
206
|
|
|
215
207
|
// default to secure if no protocol is provided
|
|
@@ -74,16 +74,6 @@ describe("determine_protocol", () => {
|
|
|
74
74
|
host: "huggingface.co"
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
|
-
|
|
78
|
-
it('should return the correct protocols and host when the endpoint starts with "file"', () => {
|
|
79
|
-
const endpoint = "file:///path/to/app.html";
|
|
80
|
-
const result = determine_protocol(endpoint);
|
|
81
|
-
expect(result).toEqual({
|
|
82
|
-
ws_protocol: "ws",
|
|
83
|
-
http_protocol: "http:",
|
|
84
|
-
host: "lite.local"
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
77
|
});
|
|
88
78
|
|
|
89
79
|
describe("parse_and_set_cookies", () => {
|
package/src/types.ts
CHANGED
|
@@ -190,7 +190,7 @@ export interface Config {
|
|
|
190
190
|
layout: any;
|
|
191
191
|
}
|
|
192
192
|
>;
|
|
193
|
-
pages: [string, string][];
|
|
193
|
+
pages: [string, string, boolean][];
|
|
194
194
|
protocol: "sse_v3" | "sse_v2.1" | "sse_v2" | "sse_v1" | "sse" | "ws";
|
|
195
195
|
max_file_size?: number;
|
|
196
196
|
theme_hash?: number;
|
|
@@ -226,6 +226,7 @@ interface SharedProps {
|
|
|
226
226
|
components?: string[];
|
|
227
227
|
server_fns?: string[];
|
|
228
228
|
interactive: boolean;
|
|
229
|
+
visible: boolean | "hidden";
|
|
229
230
|
[key: string]: unknown;
|
|
230
231
|
root_url?: string;
|
|
231
232
|
}
|
|
@@ -362,6 +363,11 @@ export interface Render {
|
|
|
362
363
|
};
|
|
363
364
|
}
|
|
364
365
|
|
|
366
|
+
export interface ValidationError {
|
|
367
|
+
is_valid: boolean;
|
|
368
|
+
message: string;
|
|
369
|
+
}
|
|
370
|
+
|
|
365
371
|
export interface Status {
|
|
366
372
|
queue: boolean;
|
|
367
373
|
code?: string;
|
|
@@ -374,7 +380,7 @@ export interface Status {
|
|
|
374
380
|
position?: number;
|
|
375
381
|
eta?: number;
|
|
376
382
|
title?: string;
|
|
377
|
-
message?: string;
|
|
383
|
+
message?: string | ValidationError[];
|
|
378
384
|
progress_data?: {
|
|
379
385
|
progress: number | null;
|
|
380
386
|
index: number | null;
|
package/src/utils/submit.ts
CHANGED
|
@@ -580,12 +580,24 @@ export function submit(
|
|
|
580
580
|
fn_index,
|
|
581
581
|
time: new Date()
|
|
582
582
|
});
|
|
583
|
+
} else if (status === 422) {
|
|
584
|
+
fire_event({
|
|
585
|
+
type: "status",
|
|
586
|
+
stage: "error",
|
|
587
|
+
message: response.detail,
|
|
588
|
+
queue: true,
|
|
589
|
+
endpoint: _endpoint,
|
|
590
|
+
fn_index,
|
|
591
|
+
code: "validation_error",
|
|
592
|
+
time: new Date()
|
|
593
|
+
});
|
|
594
|
+
close();
|
|
583
595
|
} else if (status !== 200) {
|
|
584
596
|
fire_event({
|
|
585
597
|
type: "status",
|
|
586
598
|
stage: "error",
|
|
587
|
-
broken:
|
|
588
|
-
message:
|
|
599
|
+
broken: false,
|
|
600
|
+
message: response.detail,
|
|
589
601
|
queue: true,
|
|
590
602
|
endpoint: _endpoint,
|
|
591
603
|
fn_index,
|