mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: Select derived messages from backend #2088 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -4,13 +4,12 @@ import {
|
||||
IDialog,
|
||||
IStats,
|
||||
IToken,
|
||||
Message,
|
||||
} from '@/interfaces/database/chat';
|
||||
import { IFeedbackRequestBody } from '@/interfaces/request/chat';
|
||||
import i18n from '@/locales/config';
|
||||
import { IClientConversation, IMessage } from '@/pages/chat/interface';
|
||||
import { IClientConversation } from '@/pages/chat/interface';
|
||||
import chatService from '@/services/chat-service';
|
||||
import { buildMessageUuid, isConversationIdExist } from '@/utils/chat';
|
||||
import { buildMessageListWithUuid, isConversationIdExist } from '@/utils/chat';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { message } from 'antd';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
@ -18,15 +17,6 @@ import { set } from 'lodash';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useSearchParams } from 'umi';
|
||||
|
||||
const buildMessageListWithUuid = (messages?: Message[]) => {
|
||||
return (
|
||||
messages?.map((x: Message | IMessage) => ({
|
||||
...x,
|
||||
id: buildMessageUuid(x),
|
||||
})) ?? []
|
||||
);
|
||||
};
|
||||
|
||||
//#region logic
|
||||
|
||||
export const useClickDialogCard = () => {
|
||||
@ -465,14 +455,11 @@ export const useCreateNextSharedConversation = () => {
|
||||
return { data, loading, createSharedConversation: mutateAsync };
|
||||
};
|
||||
|
||||
export const useFetchNextSharedConversation = () => {
|
||||
const {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
mutationKey: ['fetchSharedConversation'],
|
||||
mutationFn: async (conversationId: string) => {
|
||||
export const useFetchNextSharedConversation = (conversationId: string) => {
|
||||
const { data, isPending: loading } = useQuery({
|
||||
queryKey: ['fetchSharedConversation'],
|
||||
enabled: !!conversationId,
|
||||
queryFn: async () => {
|
||||
const { data } = await chatService.getExternalConversation(
|
||||
null,
|
||||
conversationId,
|
||||
@ -486,7 +473,7 @@ export const useFetchNextSharedConversation = () => {
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading, fetchConversation: mutateAsync };
|
||||
return { data, loading };
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user