Skip to content

Conversation

@nsarrazin
Copy link
Contributor

@nsarrazin nsarrazin commented May 27, 2024

This uses the prometheus metrics, takes the 90th percentile to estimate the size of the loading bar with a default to 15s.

The bar finishes quickly if done early, or hangs close to the end if late.

Screen.Recording.2024-05-28.at.01.08.43.mov

@nsarrazin nsarrazin added enhancement New feature or request front This issue is related to the front-end of the app. back This issue is related to the Svelte backend or the DB tools labels May 27, 2024
@nsarrazin nsarrazin requested review from gary149, mishig25 and saghen May 27, 2024 21:56
@mishig25
Copy link
Collaborator

mishig25 commented May 27, 2024

image

in the img above, once the img was produced, shouldn't the bar be finished as well?

question: what happens to the bar when there is an error from the tool ?

@nsarrazin
Copy link
Contributor Author

nsarrazin commented May 27, 2024

Uh I think the video I attached is loading poorly on the web, will let you try locally if you can to see if the behaviour works ok for you there

edit: attached a better example

@saghen
Copy link
Contributor

saghen commented May 28, 2024

Looks great but maybe we shouldn't animate to completion once the tool returns. Also, the estimated time can be known ahead of time for some tools (web search is 4-8s, url fetch is 2-4s, gradio spaces have an existing estimate). It might be nice to let the tools define their own estimates dynamically

and no rounding on the loading bar
}
});
// go to 100% quickly if loading is done
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure this works

Copy link
Collaborator

@mishig25 mishig25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Made a small suggestion #1191 (up to you to accept or not 👍 )

* Clear animation when done

* make the bar go to the end

---------

Co-authored-by: Nathan Sarrazin <[email protected]>
@nsarrazin
Copy link
Contributor Author

Accepted the suggestion, also made sure the loading bar goes til the end properly. Will add estimates from gradio API in a follow up PR if they are returned

@nsarrazin nsarrazin merged commit e58b1e5 into main May 28, 2024
@nsarrazin nsarrazin deleted the feat/loading_bar_tools branch May 28, 2024 09:55
<div
bind:this={loadingBarEl}
class="absolute -m-1 hidden h-full w-full rounded-l-lg bg-purple-500/5 transition-all dark:bg-purple-500/10"
class="absolute -m-1 hidden h-full w-[calc(100%+1rem)] rounded-lg bg-purple-500/5 transition-all dark:bg-purple-500/10"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looked more like a progress bar without the rounded lg on the right imo (you could add an overflow-hidden on the parent instead).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, working on bringing it back but fighting with the padding 😆

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was fine as it was imo :D even if it wasn't taking the full width

ice91 pushed a commit to ice91/chat-ui that referenced this pull request Oct 30, 2024
* Add a loading bar for tools

* move css to right file

* lighter purple

and no rounding on the loading bar

* Update src/routes/+layout.server.ts

Co-authored-by: Mishig <[email protected]>

* Clear animation when done (huggingface#1191)

* Clear animation when done

* make the bar go to the end

---------

Co-authored-by: Nathan Sarrazin <[email protected]>

---------

Co-authored-by: Victor Mustar <[email protected]>
Co-authored-by: Mishig <[email protected]>
maksym-work pushed a commit to siilats/chat-ui that referenced this pull request Jul 2, 2025
* Add a loading bar for tools

* move css to right file

* lighter purple

and no rounding on the loading bar

* Update src/routes/+layout.server.ts

Co-authored-by: Mishig <[email protected]>

* Clear animation when done (huggingface#1191)

* Clear animation when done

* make the bar go to the end

---------

Co-authored-by: Nathan Sarrazin <[email protected]>

---------

Co-authored-by: Victor Mustar <[email protected]>
Co-authored-by: Mishig <[email protected]>
Matsenas pushed a commit to Matsenas/chat-ui that referenced this pull request Jul 4, 2025
* Add a loading bar for tools

* move css to right file

* lighter purple

and no rounding on the loading bar

* Update src/routes/+layout.server.ts

Co-authored-by: Mishig <[email protected]>

* Clear animation when done (huggingface#1191)

* Clear animation when done

* make the bar go to the end

---------

Co-authored-by: Nathan Sarrazin <[email protected]>

---------

Co-authored-by: Victor Mustar <[email protected]>
Co-authored-by: Mishig <[email protected]>
Matsenas pushed a commit to Matsenas/chat-ui that referenced this pull request Jul 4, 2025
* Add a loading bar for tools

* move css to right file

* lighter purple

and no rounding on the loading bar

* Update src/routes/+layout.server.ts

Co-authored-by: Mishig <[email protected]>

* Clear animation when done (huggingface#1191)

* Clear animation when done

* make the bar go to the end

---------

Co-authored-by: Nathan Sarrazin <[email protected]>

---------

Co-authored-by: Victor Mustar <[email protected]>
Co-authored-by: Mishig <[email protected]>
gary149 added a commit to gary149/chat-ui that referenced this pull request Aug 29, 2025
* Add a loading bar for tools

* move css to right file

* lighter purple

and no rounding on the loading bar

* Update src/routes/+layout.server.ts

Co-authored-by: Mishig <[email protected]>

* Clear animation when done (huggingface#1191)

* Clear animation when done

* make the bar go to the end

---------

Co-authored-by: Nathan Sarrazin <[email protected]>

---------

Co-authored-by: Victor Mustar <[email protected]>
Co-authored-by: Mishig <[email protected]>
gary149 added a commit to gary149/chat-ui that referenced this pull request Aug 29, 2025
* Add a loading bar for tools

* move css to right file

* lighter purple

and no rounding on the loading bar

* Update src/routes/+layout.server.ts

Co-authored-by: Mishig <[email protected]>

* Clear animation when done (huggingface#1191)

* Clear animation when done

* make the bar go to the end

---------

Co-authored-by: Nathan Sarrazin <[email protected]>

---------

Co-authored-by: Victor Mustar <[email protected]>
Co-authored-by: Mishig <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

back This issue is related to the Svelte backend or the DB enhancement New feature or request front This issue is related to the front-end of the app. tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants