mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
change fetchById to call getConversationById
This commit is contained in:
parent
c271f044c7
commit
0fb9820110
1 changed files with 7 additions and 8 deletions
|
|
@ -1,15 +1,14 @@
|
||||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
import { useState, useEffect, useRef } from 'react';
|
||||||
import { useRecoilValue, useSetRecoilState, useResetRecoilState } from 'recoil';
|
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
||||||
import copy from 'copy-to-clipboard';
|
import copy from 'copy-to-clipboard';
|
||||||
import SubRow from './Content/SubRow';
|
import SubRow from './Content/SubRow';
|
||||||
import Content from './Content/Content';
|
import Content from './Content/Content';
|
||||||
import MultiMessage from './MultiMessage';
|
import MultiMessage from './MultiMessage';
|
||||||
import HoverButtons from './HoverButtons';
|
import HoverButtons from './HoverButtons';
|
||||||
import SiblingSwitch from './SiblingSwitch';
|
import SiblingSwitch from './SiblingSwitch';
|
||||||
import { fetchById } from '~/utils/fetchers';
|
|
||||||
import getIcon from '~/utils/getIcon';
|
import getIcon from '~/utils/getIcon';
|
||||||
import { useMessageHandler } from '~/utils/handleSubmit';
|
import { useMessageHandler } from '~/utils/handleSubmit';
|
||||||
|
import { getConversationById } from '~/data-provider';
|
||||||
import store from '~/store';
|
import store from '~/store';
|
||||||
|
|
||||||
export default function Message({
|
export default function Message({
|
||||||
|
|
@ -22,11 +21,10 @@ export default function Message({
|
||||||
siblingCount,
|
siblingCount,
|
||||||
setSiblingIdx
|
setSiblingIdx
|
||||||
}) {
|
}) {
|
||||||
|
const { text, searchResult, isCreatedByUser, error, submitting } = message;
|
||||||
const isSubmitting = useRecoilValue(store.isSubmitting);
|
const isSubmitting = useRecoilValue(store.isSubmitting);
|
||||||
const setLatestMessage = useSetRecoilState(store.latestMessage);
|
const setLatestMessage = useSetRecoilState(store.latestMessage);
|
||||||
// const { model, chatGptLabel, promptPrefix } = conversation;
|
|
||||||
const [abortScroll, setAbort] = useState(false);
|
const [abortScroll, setAbort] = useState(false);
|
||||||
const { text, searchResult, isCreatedByUser, error, submitting } = message;
|
|
||||||
const textEditor = useRef(null);
|
const textEditor = useRef(null);
|
||||||
const last = !message?.children?.length;
|
const last = !message?.children?.length;
|
||||||
const edit = message.messageId == currentEditId;
|
const edit = message.messageId == currentEditId;
|
||||||
|
|
@ -98,7 +96,8 @@ export default function Message({
|
||||||
|
|
||||||
const clickSearchResult = async () => {
|
const clickSearchResult = async () => {
|
||||||
if (!searchResult) return;
|
if (!searchResult) return;
|
||||||
const convoResponse = await fetchById('convos', message.conversationId);
|
//we don't need react-query for this so we call the data service directly
|
||||||
|
const convoResponse = await getConversationById(message.conversationId);
|
||||||
const convo = convoResponse.data;
|
const convo = convoResponse.data;
|
||||||
|
|
||||||
switchToConversation(convo);
|
switchToConversation(convo);
|
||||||
|
|
@ -137,7 +136,7 @@ export default function Message({
|
||||||
)}
|
)}
|
||||||
<div className="flex flex-grow flex-col gap-3">
|
<div className="flex flex-grow flex-col gap-3">
|
||||||
{error ? (
|
{error ? (
|
||||||
<div className="flex flex min-h-[20px] flex-grow flex-col items-start gap-4 gap-2 text-red-500">
|
<div className="flex min-h-[20px] flex-grow flex-col items-start gap-4 gap-2 text-red-500">
|
||||||
<div className="rounded-md border border-red-500 bg-red-500/10 py-2 px-3 text-sm text-gray-600 dark:text-gray-100">
|
<div className="rounded-md border border-red-500 bg-red-500/10 py-2 px-3 text-sm text-gray-600 dark:text-gray-100">
|
||||||
{`An error occurred. Please try again in a few moments.\n\nError message: ${text}`}
|
{`An error occurred. Please try again in a few moments.\n\nError message: ${text}`}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue