setIsConfigurationDrawerOpen(false)}
diff --git a/images/answerWithReferences.png b/images/answerWithReferences.png
new file mode 100644
index 0000000..aee27b0
Binary files /dev/null and b/images/answerWithReferences.png differ
diff --git a/images/emptyMessagesState.png b/images/emptyMessagesState.png
new file mode 100644
index 0000000..d7ad890
Binary files /dev/null and b/images/emptyMessagesState.png differ
diff --git a/images/messageWithError.png b/images/messageWithError.png
new file mode 100644
index 0000000..26137bc
Binary files /dev/null and b/images/messageWithError.png differ
diff --git a/images/responsiveDemo.gif b/images/responsiveDemo.gif
new file mode 100644
index 0000000..a976339
Binary files /dev/null and b/images/responsiveDemo.gif differ
diff --git a/images/toggleButton.png b/images/toggleButton.png
new file mode 100644
index 0000000..1c7f3af
Binary files /dev/null and b/images/toggleButton.png differ
diff --git a/src/components/ChatItem.tsx b/src/components/ChatItem.tsx
index 4d8a615..07bb727 100644
--- a/src/components/ChatItem.tsx
+++ b/src/components/ChatItem.tsx
@@ -54,12 +54,11 @@ export const ChatItem = ({ question, answer, searchResults, onRetry }: Props) =>
content = (
-
+
-
Message not sent.
{onRetry && (
diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsx
index 84e0456..360524e 100644
--- a/src/components/ChatView.tsx
+++ b/src/components/ChatView.tsx
@@ -54,7 +54,7 @@ export const ChatView = ({
}: Props) => {
const [isOpen, setIsOpen] = useState(isInitiallyOpen ?? false);
const [query, setQuery] = useState("");
- const { sendMessage, messageHistory, isLoading, error } = useChat(customerId, corpusIds, apiKey);
+ const { sendMessage, messageHistory, isLoading, hasError } = useChat(customerId, corpusIds, apiKey);
const appLayoutRef = useRef(null);
const isScrolledToBottomRef = useRef(true);
@@ -98,7 +98,9 @@ export const ChatView = ({
const chatItems = messageHistory.map((turn, index) => {
const { question, answer, results } = turn;
const onRetry =
- error && index === messageHistory.length - 1 ? () => sendMessage({ query: question, isRetry: true }) : undefined;
+ hasError && index === messageHistory.length - 1
+ ? () => sendMessage({ query: question, isRetry: true })
+ : undefined;
return ;
});
diff --git a/src/useChat.ts b/src/useChat.ts
index dae2647..14ac27a 100644
--- a/src/useChat.ts
+++ b/src/useChat.ts
@@ -12,7 +12,7 @@ export const useChat = (customerId: string, corpusIds: string[], apiKey: string)
const [recentAnswer, setRecentAnswer] = useState();
const [isLoading, setIsLoading] = useState(false);
const [conversationId, setConversationId] = useState();
- const [error, setError] = useState(false);
+ const [hasError, setHasError] = useState(false);
const getLanguage = (languageValue?: string): SummaryLanguage => (languageValue ?? "eng") as SummaryLanguage;
const sendMessage = async ({ query, isRetry = false }: { query: string; isRetry?: boolean }) => {
@@ -34,7 +34,7 @@ export const useChat = (customerId: string, corpusIds: string[], apiKey: string)
];
});
} else {
- setError(false);
+ setHasError(false);
}
const baseSearchRequestParams = {
@@ -60,7 +60,7 @@ export const useChat = (customerId: string, corpusIds: string[], apiKey: string)
try {
initialSearchResponse = await sendSearchRequest(baseSearchRequestParams);
} catch (error) {
- setError(true);
+ setHasError(true);
setIsLoading(false);
return [];
}
@@ -109,6 +109,6 @@ export const useChat = (customerId: string, corpusIds: string[], apiKey: string)
sendMessage,
messageHistory,
isLoading,
- error
+ hasError
};
};