mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 17:30:16 +01:00
feat: print nothing found when no search result.
fix: handle 404 of conversation fetch failed
This commit is contained in:
parent
370dc2dd8a
commit
d0d0a3d23e
3 changed files with 11 additions and 14 deletions
|
|
@ -101,23 +101,10 @@ export default function Message({
|
||||||
|
|
||||||
const clickSearchResult = async () => {
|
const clickSearchResult = async () => {
|
||||||
if (!searchResult) return;
|
if (!searchResult) return;
|
||||||
// dispatch(setMessages([]));
|
|
||||||
const convoResponse = await fetchById('convos', message.conversationId);
|
const convoResponse = await fetchById('convos', message.conversationId);
|
||||||
const convo = convoResponse.data;
|
const convo = convoResponse.data;
|
||||||
// if (convo?.chatGptLabel) {
|
|
||||||
// // dispatch(setModel('chatgptCustom'));
|
|
||||||
// // dispatch(setCustomModel(convo.chatGptLabel.toLowerCase()));
|
|
||||||
// } else {
|
|
||||||
// // dispatch(setModel(convo.model));
|
|
||||||
// // dispatch(setCustomModel(null));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// dispatch(setCustomGpt(convo));
|
|
||||||
switchToConversation(convo);
|
switchToConversation(convo);
|
||||||
// dispatch(setConversation(convo));
|
|
||||||
// const { data } = await fetchById('messages', message.conversationId);
|
|
||||||
// dispatch(setMessages(data));
|
|
||||||
// dispatch(setDisabled(false));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,10 @@ export default function Messages({ isSearchView = false }) {
|
||||||
</div>
|
</div>
|
||||||
{_messagesTree === null ? (
|
{_messagesTree === null ? (
|
||||||
<Spinner />
|
<Spinner />
|
||||||
|
) : _messagesTree?.length == 0 && isSearchView ? (
|
||||||
|
<div className="flex w-full items-center justify-center gap-1 bg-gray-50 p-3 text-sm text-gray-500 dark:border-gray-900/50 dark:bg-gray-800 dark:text-gray-300">
|
||||||
|
Nothing found
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<MultiMessage
|
<MultiMessage
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,13 @@ export default function Chat() {
|
||||||
newConversation();
|
newConversation();
|
||||||
} else if (conversationId) {
|
} else if (conversationId) {
|
||||||
// fetch it from server
|
// fetch it from server
|
||||||
conversationTrigger().then(setConversation);
|
conversationTrigger()
|
||||||
|
.then(setConversation)
|
||||||
|
.catch(error => {
|
||||||
|
console.error('failed to fetch the conversation');
|
||||||
|
console.error(error);
|
||||||
|
newConversation();
|
||||||
|
});
|
||||||
setMessages(null);
|
setMessages(null);
|
||||||
} else {
|
} else {
|
||||||
navigate(`/chat/new`);
|
navigate(`/chat/new`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue