nsarrazin HF Staff commited on
Commit
f940e40
·
unverified ·
1 Parent(s): 005574a

Fix display websearch when using tools (#1197)

Browse files
src/lib/components/chat/ToolUpdate.svelte CHANGED
@@ -11,6 +11,7 @@
11
  import type { ToolFront } from "$lib/types/Tool";
12
  import { page } from "$app/stores";
13
  import { onMount } from "svelte";
 
14
 
15
  export let tool: MessageToolUpdate[];
16
  export let loading: boolean = false;
@@ -26,7 +27,7 @@
26
 
27
  let isShowingLoadingBar = false;
28
  onMount(() => {
29
- if (!toolDone && loading) {
30
  loadingBarEl.classList.remove("hidden");
31
  isShowingLoadingBar = true;
32
  animation = loadingBarEl.animate([{ width: "0%" }, { width: "calc(100%+1rem)" }], {
@@ -39,6 +40,8 @@
39
 
40
  // go to 100% quickly if loading is done
41
  $: (!loading || toolDone) &&
 
 
42
  isShowingLoadingBar &&
43
  (() => {
44
  isShowingLoadingBar = false;
 
11
  import type { ToolFront } from "$lib/types/Tool";
12
  import { page } from "$app/stores";
13
  import { onMount } from "svelte";
14
+ import { browser } from "$app/environment";
15
 
16
  export let tool: MessageToolUpdate[];
17
  export let loading: boolean = false;
 
27
 
28
  let isShowingLoadingBar = false;
29
  onMount(() => {
30
+ if (!toolDone && loading && loadingBarEl) {
31
  loadingBarEl.classList.remove("hidden");
32
  isShowingLoadingBar = true;
33
  animation = loadingBarEl.animate([{ width: "0%" }, { width: "calc(100%+1rem)" }], {
 
40
 
41
  // go to 100% quickly if loading is done
42
  $: (!loading || toolDone) &&
43
+ browser &&
44
+ loadingBarEl &&
45
  isShowingLoadingBar &&
46
  (() => {
47
  isShowingLoadingBar = false;