mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-29 13:46:18 +01:00
40 lines
856 B
TypeScript
40 lines
856 B
TypeScript
|
|
import { useMemo } from 'react';
|
||
|
|
import useGenerateConvo from '~/hooks/Conversations/useGenerateConvo';
|
||
|
|
import useAddedHelpers from '~/hooks/Chat/useAddedHelpers';
|
||
|
|
|
||
|
|
export default function useAddedResponse({ rootIndex }: { rootIndex: number }) {
|
||
|
|
const currentIndex = useMemo(() => rootIndex + 1, [rootIndex]);
|
||
|
|
const {
|
||
|
|
ask,
|
||
|
|
regenerate,
|
||
|
|
setMessages,
|
||
|
|
getMessages,
|
||
|
|
conversation,
|
||
|
|
isSubmitting,
|
||
|
|
setConversation,
|
||
|
|
setIsSubmitting,
|
||
|
|
} = useAddedHelpers({
|
||
|
|
rootIndex,
|
||
|
|
currentIndex,
|
||
|
|
});
|
||
|
|
|
||
|
|
const { generateConversation } = useGenerateConvo({
|
||
|
|
index: currentIndex,
|
||
|
|
rootIndex,
|
||
|
|
setConversation,
|
||
|
|
});
|
||
|
|
|
||
|
|
return {
|
||
|
|
ask,
|
||
|
|
regenerate,
|
||
|
|
getMessages,
|
||
|
|
setMessages,
|
||
|
|
conversation,
|
||
|
|
isSubmitting,
|
||
|
|
setConversation,
|
||
|
|
setIsSubmitting,
|
||
|
|
generateConversation,
|
||
|
|
addedIndex: currentIndex,
|
||
|
|
};
|
||
|
|
}
|