mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-28 05:06:13 +01:00
feat: convert Chat.jsx to RQ
This commit is contained in:
parent
573112de7b
commit
1cb8ef9803
6 changed files with 53 additions and 111 deletions
|
|
@ -2,10 +2,6 @@ import * as t from './types';
|
|||
import request from './request';
|
||||
import * as endpoints from './endpoints';
|
||||
|
||||
export function postAICompletion(payload: t.TAICompletionRequest) {
|
||||
return request.post(endpoints.getAICompletion(), payload);
|
||||
}
|
||||
|
||||
export function getConversations(pageNumber: string): Promise<t.TGetConversationsResponse> {
|
||||
return request.get(endpoints.getConversations(pageNumber));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
export const openAiModels = () => {
|
||||
return `/api/open-ai-models`;
|
||||
};
|
||||
|
||||
export const getModels = () => {
|
||||
return `/api/models`;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,23 @@ export const useGetConversationByIdQuery = (
|
|||
);
|
||||
}
|
||||
|
||||
//This isn't ideal because its just a query and we're using mutation, but it was the only way
|
||||
//to make it work with how the Chat component is structured
|
||||
export const useGetConversationByIdMutation = (
|
||||
id: string,
|
||||
callback: (data: t.TConversation) => void
|
||||
): UseMutationResult<t.TConversation> => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation(() => dataService.getConversationById(id),
|
||||
{
|
||||
onSuccess: (res: t.TConversation) => {
|
||||
callback(res);
|
||||
queryClient.invalidateQueries([QueryKeys.conversation, id]);
|
||||
},
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const useUpdateConversationMutation = (
|
||||
id: string
|
||||
): UseMutationResult<
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
export type TMessage = {
|
||||
messageId: string,
|
||||
conversationId: string,
|
||||
conversationSignature: string | null,
|
||||
// conversationSignature: string | null,
|
||||
clientId: string,
|
||||
invocationId: string,
|
||||
// invocationId: string,
|
||||
parentMessageId: string,
|
||||
sender: string,
|
||||
text: string,
|
||||
|
|
@ -11,12 +11,12 @@ export type TMessage = {
|
|||
error: boolean,
|
||||
createdAt: string,
|
||||
updatedAt: string,
|
||||
searchResult: string[],
|
||||
submitting: boolean,
|
||||
children?: any[] | undefined,
|
||||
bgColor?: string,
|
||||
model?: string,
|
||||
cancelled?: boolean
|
||||
// searchResult: string[],
|
||||
// submitting: boolean,
|
||||
// children?: any[] | undefined,
|
||||
// bgColor?: string,
|
||||
// model?: string,
|
||||
// cancelled?: boolean
|
||||
};
|
||||
|
||||
export type TMessageTreeNode = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue