mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-27 05:38:51 +01:00
refactor: streamline conversation title generation handling
- Removed unused type definition for TGenTitleMutation in mutations.ts to clean up the codebase. - Integrated queueTitleGeneration call in useEventHandlers to trigger title generation for new conversations, enhancing the responsiveness of the application.
This commit is contained in:
parent
dc81abcc01
commit
cf963ca345
2 changed files with 5 additions and 7 deletions
|
|
@ -18,13 +18,6 @@ import useUpdateTagsInConvo from '~/hooks/Conversations/useUpdateTagsInConvo';
|
|||
import { updateConversationTag } from '~/utils/conversationTags';
|
||||
import { useConversationTagsQuery } from './queries';
|
||||
|
||||
export type TGenTitleMutation = UseMutationResult<
|
||||
t.TGenTitleResponse,
|
||||
unknown,
|
||||
t.TGenTitleRequest,
|
||||
unknown
|
||||
>;
|
||||
|
||||
export const useUpdateConversationMutation = (
|
||||
id: string,
|
||||
): UseMutationResult<
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import {
|
|||
removeConvoFromAllQueries,
|
||||
findConversationInInfinite,
|
||||
} from '~/utils';
|
||||
import { queueTitleGeneration } from '~/data-provider/SSE/queries';
|
||||
import useAttachmentHandler from '~/hooks/SSE/useAttachmentHandler';
|
||||
import useContentHandler from '~/hooks/SSE/useContentHandler';
|
||||
import useStepHandler from '~/hooks/SSE/useStepHandler';
|
||||
|
|
@ -466,6 +467,10 @@ export default function useEventHandlers({
|
|||
|
||||
const isNewConvo = conversation.conversationId !== submissionConvo.conversationId;
|
||||
|
||||
if (isNewConvo && conversation.conversationId) {
|
||||
queueTitleGeneration(conversation.conversationId);
|
||||
}
|
||||
|
||||
const setFinalMessages = (id: string | null, _messages: TMessage[]) => {
|
||||
setMessages(_messages);
|
||||
queryClient.setQueryData<TMessage[]>([QueryKeys.messages, id], _messages);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue