@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.
@@ -0,0 +1,125 @@
1
+ <script lang="ts">
2
+ import { format_latency } from "./utils";
3
+
4
+ export let p50: number;
5
+ export let p90: number;
6
+ export let p99: number;
7
+
8
+ $: max_latency = Math.max(p50, p90, p99);
9
+ </script>
10
+
11
+ <div class="tooltip-chart">
12
+ <div class="tooltip-arrow"></div>
13
+ <div class="chart-bars">
14
+ <div class="chart-bar-container">
15
+ <div class="chart-bar-label">p50</div>
16
+ <div class="chart-bar-wrapper">
17
+ <div
18
+ class="chart-bar"
19
+ style="width: {(p50 / max_latency) * 100}%"
20
+ ></div>
21
+ </div>
22
+ <div class="chart-bar-value">{format_latency(p50)}</div>
23
+ </div>
24
+ <div class="chart-bar-container">
25
+ <div class="chart-bar-label">p90</div>
26
+ <div class="chart-bar-wrapper">
27
+ <div
28
+ class="chart-bar"
29
+ style="width: {(p90 / max_latency) * 100}%"
30
+ ></div>
31
+ </div>
32
+ <div class="chart-bar-value">{format_latency(p90)}</div>
33
+ </div>
34
+ <div class="chart-bar-container">
35
+ <div class="chart-bar-label">p99</div>
36
+ <div class="chart-bar-wrapper">
37
+ <div
38
+ class="chart-bar"
39
+ style="width: {(p99 / max_latency) * 100}%"
40
+ ></div>
41
+ </div>
42
+ <div class="chart-bar-value">{format_latency(p99)}</div>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ <style>
48
+ .tooltip-chart {
49
+ background: var(--background-fill-primary);
50
+ border: 1px solid var(--border-color-primary);
51
+ border-radius: var(--radius-md);
52
+ padding: var(--size-3);
53
+ box-shadow: var(--shadow-drop-lg);
54
+ min-width: 200px;
55
+ position: relative;
56
+ }
57
+
58
+ .tooltip-arrow {
59
+ position: absolute;
60
+ bottom: -8px;
61
+ left: 50%;
62
+ transform: translateX(-50%);
63
+ width: 0;
64
+ height: 0;
65
+ border-left: 8px solid transparent;
66
+ border-right: 8px solid transparent;
67
+ border-top: 8px solid var(--border-color-primary);
68
+ }
69
+
70
+ .tooltip-arrow::after {
71
+ content: "";
72
+ position: absolute;
73
+ bottom: 1px;
74
+ left: 50%;
75
+ transform: translateX(-50%);
76
+ width: 0;
77
+ height: 0;
78
+ border-left: 7px solid transparent;
79
+ border-right: 7px solid transparent;
80
+ border-top: 7px solid var(--background-fill-primary);
81
+ }
82
+
83
+ .chart-bars {
84
+ display: flex;
85
+ flex-direction: column;
86
+ gap: var(--size-2);
87
+ }
88
+
89
+ .chart-bar-container {
90
+ display: flex;
91
+ align-items: center;
92
+ gap: var(--size-2);
93
+ }
94
+
95
+ .chart-bar-label {
96
+ font-size: var(--text-sm);
97
+ font-weight: var(--weight-semibold);
98
+ color: var(--body-text-color);
99
+ min-width: 30px;
100
+ }
101
+
102
+ .chart-bar-wrapper {
103
+ flex: 1;
104
+ height: 16px;
105
+ background: var(--background-fill-secondary);
106
+ border-radius: var(--radius-sm);
107
+ overflow: hidden;
108
+ position: relative;
109
+ }
110
+
111
+ .chart-bar {
112
+ height: 100%;
113
+ background: var(--color-accent);
114
+ border-radius: var(--radius-sm);
115
+ transition: width 0.3s ease;
116
+ }
117
+
118
+ .chart-bar-value {
119
+ font-size: var(--text-sm);
120
+ color: var(--body-text-color);
121
+ min-width: 50px;
122
+ text-align: right;
123
+ font-family: var(--font-mono);
124
+ }
125
+ </style>
@@ -0,0 +1,22 @@
1
+ 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
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const PercentileChart: $$__sveltets_2_IsomorphicComponent<{
15
+ p50: number;
16
+ p90: number;
17
+ p99: number;
18
+ }, {
19
+ [evt: string]: CustomEvent<any>;
20
+ }, {}, {}, string>;
21
+ type PercentileChart = InstanceType<typeof PercentileChart>;
22
+ export default PercentileChart;
@@ -21,6 +21,8 @@ export declare class Dependency {
21
21
  triggers: [number, "success" | "failure" | "all"][];
22
22
  original_trigger_id: number | null;
23
23
  show_progress_on: number[] | null;
24
+ component_prop_inputs: number[];
25
+ show_progress: "full" | "minimal" | "hidden";
24
26
  functions: {
25
27
  frontend?: (...args: unknown[]) => Promise<unknown[]>;
26
28
  backend: boolean;
@@ -115,9 +117,10 @@ export declare class DependencyManager {
115
117
  * Gathers the current state of the inputs
116
118
  *
117
119
  * @param ids the ids of the components to gather state from
120
+ * @param prop_indices the indices (relative to ids array) that should return all component props instead of just the value
118
121
  * @returns an array of the current state of the components, in the same order as the ids
119
122
  */
120
- gather_state(ids: number[]): Promise<(unknown | null)[]>;
123
+ gather_state(ids: number[], prop_indices?: number[]): Promise<(unknown | null)[]>;
121
124
  /** Sets the event arguments for a specific component
122
125
  *
123
126
  * @param id the id of the component to set the event arguments for
@@ -24,6 +24,8 @@ export class Dependency {
24
24
  // in the case of chained events, it would be the id of the initial trigger
25
25
  original_trigger_id = null;
26
26
  show_progress_on = null;
27
+ component_prop_inputs = [];
28
+ show_progress;
27
29
  functions;
28
30
  constructor(dep_config) {
29
31
  this.id = dep_config.id;
@@ -31,6 +33,7 @@ export class Dependency {
31
33
  this.inputs = dep_config.inputs;
32
34
  this.outputs = dep_config.outputs;
33
35
  this.connection_type = dep_config.connection;
36
+ this.show_progress = dep_config.show_progress;
34
37
  this.functions = {
35
38
  frontend: dep_config.js
36
39
  ? process_frontend_fn(dep_config.js, dep_config.backend_fn, dep_config.inputs.length, dep_config.outputs.length)
@@ -45,6 +48,7 @@ export class Dependency {
45
48
  this.cancels = dep_config.cancels;
46
49
  this.trigger_modes = dep_config.trigger_mode;
47
50
  this.show_progress_on = dep_config.show_progress_on || null;
51
+ this.component_prop_inputs = dep_config.component_prop_inputs || [];
48
52
  for (let i = 0; i < dep_config.event_specific_args?.length || 0; i++) {
49
53
  const key = dep_config.event_specific_args[i];
50
54
  this.event_args[key] = dep_config[key] ?? null;
@@ -117,31 +121,30 @@ export class DependencyManager {
117
121
  loading_stati = new LoadingStatus();
118
122
  constructor(dependencies, client, update_state_cb, get_state_cb, rerender_cb, log_cb, add_to_api_calls) {
119
123
  this.add_to_api_calls = add_to_api_calls;
120
- this.client = client;
121
124
  this.log_cb = log_cb;
122
- // this.update_state_cb = update_state_cb;
123
- // this.get_state_cb = get_state_cb;
124
- // this.rerender_cb = rerender_cb;
125
- this.reload(dependencies, update_state_cb, get_state_cb, rerender_cb);
125
+ this.update_state_cb = update_state_cb;
126
+ this.get_state_cb = get_state_cb;
127
+ this.rerender_cb = rerender_cb;
128
+ this.reload(dependencies, update_state_cb, get_state_cb, rerender_cb, client);
126
129
  }
127
130
  reload(dependencies, update_state, get_state, rerender, client) {
128
131
  const { by_id, by_event } = this.create(dependencies);
129
132
  this.dependencies_by_event = by_event;
130
133
  this.dependencies_by_fn = by_id;
134
+ this.client = client;
135
+ this.update_state_cb = update_state;
136
+ this.get_state_cb = get_state;
137
+ this.rerender_cb = rerender;
131
138
  for (const [dep_id, dep] of this.dependencies_by_fn) {
132
139
  for (const [output_id] of dep.targets) {
133
140
  this.set_event_args(output_id, dep.event_args);
134
141
  }
135
142
  }
136
- this.client = client;
137
- this.update_state_cb = update_state;
138
- this.get_state_cb = get_state;
139
- this.rerender_cb = rerender;
140
143
  this.register_loading_stati(by_id);
141
144
  }
142
145
  register_loading_stati(deps) {
143
146
  for (const [_, dep] of deps) {
144
- this.loading_stati.register(dep.id, dep.show_progress_on || dep.outputs, dep.inputs);
147
+ this.loading_stati.register(dep.id, dep.show_progress_on || dep.outputs, dep.inputs, dep.show_progress);
145
148
  }
146
149
  }
147
150
  clear_loading_status(component_id) {
@@ -206,7 +209,7 @@ export class DependencyManager {
206
209
  });
207
210
  this.update_loading_stati_state();
208
211
  }
209
- const data_payload = await this.gather_state(dep.inputs);
212
+ const data_payload = await this.gather_state(dep.inputs, dep.component_prop_inputs);
210
213
  const unset_args = await Promise.all(dep.targets.map(([output_id]) => this.set_event_args(output_id, dep.event_args)));
211
214
  const { success, failure, all } = dep.get_triggers();
212
215
  try {
@@ -241,7 +244,7 @@ export class DependencyManager {
241
244
  unset_args.forEach((fn) => fn());
242
245
  }
243
246
  else if (dep_submission.type === "data") {
244
- this.handle_data(dep.outputs, dep_submission.data);
247
+ await this.handle_data(dep.outputs, dep_submission.data);
245
248
  unset_args.forEach((fn) => fn());
246
249
  }
247
250
  else {
@@ -268,7 +271,7 @@ export class DependencyManager {
268
271
  if (result === null)
269
272
  continue;
270
273
  if (result.type === "data") {
271
- this.handle_data(dep.outputs, result.data);
274
+ await this.handle_data(dep.outputs, result.data);
272
275
  }
273
276
  if (result.type === "status") {
274
277
  if (result.original_msg === "process_starts" &&
@@ -356,6 +359,12 @@ export class DependencyManager {
356
359
  }
357
360
  }
358
361
  if (result.type === "render") {
362
+ this.loading_stati.update({
363
+ status: "complete",
364
+ fn_index: dep.id,
365
+ stream_state: null
366
+ });
367
+ this.update_loading_stati_state();
359
368
  const { layout, components, render_id, dependencies } = result.data;
360
369
  this.rerender_cb(components, layout);
361
370
  // update dependencies
@@ -470,7 +479,7 @@ export class DependencyManager {
470
479
  * @param data the data to update the components with
471
480
  * */
472
481
  async handle_data(outputs, data) {
473
- outputs.forEach(async (output_id, i) => {
482
+ await Promise.all(outputs.map(async (output_id, i) => {
474
483
  const _data = data[i] === undefined ? NOVALUE : data[i];
475
484
  if (_data === NOVALUE)
476
485
  return;
@@ -498,16 +507,20 @@ export class DependencyManager {
498
507
  else {
499
508
  await this.update_state_cb(output_id, { value: _data }, false);
500
509
  }
501
- });
510
+ }));
502
511
  }
503
512
  /**
504
513
  * Gathers the current state of the inputs
505
514
  *
506
515
  * @param ids the ids of the components to gather state from
516
+ * @param prop_indices the indices (relative to ids array) that should return all component props instead of just the value
507
517
  * @returns an array of the current state of the components, in the same order as the ids
508
518
  */
509
- async gather_state(ids) {
510
- return (await Promise.all(ids.map((id) => this.get_state_cb(id)))).map((state) => {
519
+ async gather_state(ids, prop_indices = []) {
520
+ return (await Promise.all(ids.map((id) => this.get_state_cb(id)))).map((state, index) => {
521
+ if (prop_indices.includes(index)) {
522
+ return state ?? null;
523
+ }
511
524
  return state?.value ?? null;
512
525
  });
513
526
  }
@@ -519,7 +532,9 @@ export class DependencyManager {
519
532
  */
520
533
  async set_event_args(id, args) {
521
534
  let current_args = {};
522
- const current_state = await this.get_state_cb(id);
535
+ const current_state = await this.get_state_cb?.(id);
536
+ if (!current_state)
537
+ return () => { };
523
538
  for (const [key] of Object.entries(args)) {
524
539
  current_args[key] = current_state?.[key] ?? null;
525
540
  }
@@ -71,6 +71,7 @@ export interface Dependency {
71
71
  like_user_message: boolean;
72
72
  event_specific_args: ("time_limit" | "stream_every" | "like_user_message")[];
73
73
  js_implementation: string | null;
74
+ component_prop_inputs: number[];
74
75
  }
75
76
  interface TypeDescription {
76
77
  input_payload?: string;
package/package.json CHANGED
@@ -1,68 +1,67 @@
1
1
  {
2
2
  "name": "@gradio/core",
3
- "version": "1.0.0-dev.3",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
- "@gradio/accordion": "^0.5.25-dev.1",
7
- "@gradio/annotatedimage": "^0.10.1-dev.2",
8
- "@gradio/audio": "^0.20.0-dev.4",
9
- "@gradio/box": "^0.2.26-dev.1",
10
- "@gradio/atoms": "^0.19.0-dev.1",
11
- "@gradio/browserstate": "^0.3.3-dev.0",
12
- "@gradio/button": "^0.5.14-dev.2",
13
- "@gradio/chatbot": "^0.28.0-dev.3",
14
- "@gradio/checkboxgroup": "^0.8.0-dev.2",
15
- "@gradio/checkbox": "^0.5.0-dev.1",
16
- "@gradio/client": "^2.0.0-dev.2",
17
- "@gradio/colorpicker": "^0.5.0-dev.2",
18
- "@gradio/column": "^0.2.2",
19
- "@gradio/dataframe": "^0.21.0-dev.3",
20
- "@gradio/code": "^0.16.0-dev.3",
21
- "@gradio/dataset": "^0.5.0-dev.3",
22
- "@gradio/datetime": "^0.3.23-dev.1",
23
- "@gradio/downloadbutton": "^0.4.13-dev.1",
24
- "@gradio/file": "^0.13.1-dev.2",
25
- "@gradio/dropdown": "^0.10.6-dev.2",
26
- "@gradio/fallback": "^0.4.30-dev.1",
27
- "@gradio/form": "^0.2.26-dev.1",
28
- "@gradio/fileexplorer": "^0.5.42-dev.2",
29
- "@gradio/html": "^0.8.0-dev.1",
30
- "@gradio/highlightedtext": "^0.9.14-dev.1",
31
- "@gradio/image": "^0.24.0-dev.2",
32
- "@gradio/group": "^0.2.1",
33
- "@gradio/icons": "^0.15.0-dev.0",
34
- "@gradio/imageeditor": "^0.18.2-dev.2",
35
- "@gradio/gallery": "^0.15.35-dev.3",
36
- "@gradio/imageslider": "^0.3.1-dev.2",
37
- "@gradio/label": "^0.5.22-dev.1",
38
- "@gradio/json": "^0.5.32-dev.1",
39
- "@gradio/markdown": "^0.13.23-dev.1",
40
- "@gradio/model3d": "^0.15.1-dev.2",
41
- "@gradio/multimodaltextbox": "^0.11.0-dev.2",
42
- "@gradio/nativeplot": "^0.9.0-dev.2",
43
- "@gradio/paramviewer": "^0.9.0-dev.1",
44
- "@gradio/number": "^0.7.2-dev.1",
45
- "@gradio/plot": "^0.9.25-dev.1",
46
- "@gradio/radio": "^0.8.0-dev.1",
47
- "@gradio/row": "^0.2.2",
48
- "@gradio/sidebar": "^0.1.24-dev.1",
49
- "@gradio/simpleimage": "^0.9.1-dev.2",
50
- "@gradio/simpletextbox": "^0.3.31-dev.1",
51
- "@gradio/simpledropdown": "^0.3.30-dev.1",
52
- "@gradio/sketchbox": "^0.6.18-dev.1",
53
- "@gradio/slider": "^0.7.0-dev.2",
54
- "@gradio/state": "^0.1.2",
55
- "@gradio/statustracker": "^0.12.0-dev.1",
56
- "@gradio/tabs": "^0.5.2-dev.0",
57
- "@gradio/tabitem": "^0.6.2-dev.0",
58
- "@gradio/theme": "^0.5.0-dev.0",
59
- "@gradio/timer": "^0.4.6-dev.0",
60
- "@gradio/textbox": "^0.12.0-dev.2",
61
- "@gradio/upload": "^0.17.2-dev.2",
62
- "@gradio/utils": "^0.10.3-dev.0",
63
- "@gradio/uploadbutton": "^0.9.13-dev.1",
64
- "@gradio/video": "^0.17.0-dev.2",
65
- "@gradio/vibeeditor": "^0.3.1-dev.2"
6
+ "@gradio/accordion": "^0.5.25",
7
+ "@gradio/audio": "^0.20.0",
8
+ "@gradio/atoms": "^0.19.0",
9
+ "@gradio/box": "^0.2.26",
10
+ "@gradio/browserstate": "^0.3.3",
11
+ "@gradio/button": "^0.5.14",
12
+ "@gradio/annotatedimage": "^0.10.1",
13
+ "@gradio/chatbot": "^0.28.0",
14
+ "@gradio/checkbox": "^0.5.0",
15
+ "@gradio/client": "^2.0.0",
16
+ "@gradio/checkboxgroup": "^0.8.0",
17
+ "@gradio/column": "^0.3.0",
18
+ "@gradio/code": "^0.16.0",
19
+ "@gradio/colorpicker": "^0.5.0",
20
+ "@gradio/dataframe": "^0.21.0",
21
+ "@gradio/dataset": "^0.5.0",
22
+ "@gradio/downloadbutton": "^0.4.13",
23
+ "@gradio/datetime": "^0.3.23",
24
+ "@gradio/dropdown": "^0.10.6",
25
+ "@gradio/file": "^0.13.1",
26
+ "@gradio/fallback": "^0.4.30",
27
+ "@gradio/fileexplorer": "^0.5.42",
28
+ "@gradio/group": "^0.3.0",
29
+ "@gradio/gallery": "^0.15.35",
30
+ "@gradio/form": "^0.2.26",
31
+ "@gradio/highlightedtext": "^0.9.14",
32
+ "@gradio/html": "^0.8.0",
33
+ "@gradio/icons": "^0.15.0",
34
+ "@gradio/image": "^0.24.0",
35
+ "@gradio/imageeditor": "^0.18.2",
36
+ "@gradio/imageslider": "^0.3.1",
37
+ "@gradio/json": "^0.5.32",
38
+ "@gradio/model3d": "^0.15.1",
39
+ "@gradio/markdown": "^0.13.23",
40
+ "@gradio/label": "^0.5.22",
41
+ "@gradio/multimodaltextbox": "^0.11.0",
42
+ "@gradio/nativeplot": "^0.9.0",
43
+ "@gradio/paramviewer": "^0.9.0",
44
+ "@gradio/number": "^0.7.2",
45
+ "@gradio/plot": "^0.9.25",
46
+ "@gradio/row": "^0.3.0",
47
+ "@gradio/radio": "^0.8.0",
48
+ "@gradio/sidebar": "^0.1.24",
49
+ "@gradio/simpledropdown": "^0.3.30",
50
+ "@gradio/simpleimage": "^0.9.1",
51
+ "@gradio/simpletextbox": "^0.3.31",
52
+ "@gradio/slider": "^0.7.0",
53
+ "@gradio/state": "^0.2.0",
54
+ "@gradio/statustracker": "^0.12.0",
55
+ "@gradio/tabitem": "^0.6.2",
56
+ "@gradio/tabs": "^0.5.2",
57
+ "@gradio/textbox": "^0.12.0",
58
+ "@gradio/theme": "^0.5.0",
59
+ "@gradio/timer": "^0.4.6",
60
+ "@gradio/uploadbutton": "^0.9.13",
61
+ "@gradio/upload": "^0.17.2",
62
+ "@gradio/vibeeditor": "^0.3.1",
63
+ "@gradio/utils": "^0.10.3",
64
+ "@gradio/video": "^0.17.0"
66
65
  },
67
66
  "msw": {
68
67
  "workerDirectory": "public"
package/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
- api_calls = [...api_calls, payload];
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: ComponentType | null = null;
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}
@@ -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 dependencies as dependency}
469
- {#if dependency.api_visibility === "public" && info.named_endpoints["/" + dependency.api_name]}
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
 
@@ -4,9 +4,6 @@
4
4
 
5
5
  export let api_calls: Payload[] = [];
6
6
  export let dependencies: Dependency[];
7
-
8
- $: console.log("API CALLS UPDATED:", api_calls);
9
- $: console.log("DEPENDENCIES:", dependencies);
10
7
  </script>
11
8
 
12
9
  <div id="api-recorder">