From c2bf405489238a4e79544810bbe8d11f02a1db30 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 14 Jul 2024 12:58:29 +0530 Subject: [PATCH] Make loading message, styling configurable. Do not show agent when no data - Pass Loading message, class name via props to both inline and normal loading spinners - Pass loading conversation message to loading spinner when chat history is being fetched --- .../components/chatHistory/chatHistory.tsx | 22 ++++++++++--------- .../web/app/components/loading/loading.tsx | 19 ++++++++-------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/interface/web/app/components/chatHistory/chatHistory.tsx b/src/interface/web/app/components/chatHistory/chatHistory.tsx index d8052a04..78093cec 100644 --- a/src/interface/web/app/components/chatHistory/chatHistory.tsx +++ b/src/interface/web/app/components/chatHistory/chatHistory.tsx @@ -247,7 +247,7 @@ export default function ChatHistory(props: ChatHistoryProps) {
- {fetchingData && } + {fetchingData && }
{(data && data.chat) && data.chat.map((chatMessage, index) => ( } -
-
- } - description={constructAgentPersona()} - /> + {data && +
+
+ } + description={constructAgentPersona()} + /> +
-
+ }
diff --git a/src/interface/web/app/components/loading/loading.tsx b/src/interface/web/app/components/loading/loading.tsx index 650011d7..55ada004 100644 --- a/src/interface/web/app/components/loading/loading.tsx +++ b/src/interface/web/app/components/loading/loading.tsx @@ -1,22 +1,23 @@ import { CircleNotch } from '@phosphor-icons/react'; -export default function Loading() { +interface LoadingProps { + className?: string; + message?: string; +} + +export default function Loading(props: LoadingProps) { return ( // NOTE: We can display usage tips here for casual learning moments. -
-
Loading
+
+
{props.message || "Loading" }
); } -interface InlineLoadingProps { - className?: string; -} - -export function InlineLoading(props: InlineLoadingProps) { +export function InlineLoading(props: LoadingProps) { return ( ) }