Merge remote-tracking branch 'upstream/dev' into feat/ui-revamp

This commit is contained in:
Anish Sarkar 2026-05-16 19:26:36 +05:30
commit f65bc81509
603 changed files with 45035 additions and 4652 deletions

View file

@ -11,6 +11,7 @@ import { cacheKeys } from "@/lib/query-client/cache-keys";
import { queryClient } from "@/lib/query-client/client";
export const createCommentMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: CreateCommentRequest) => {
return chatCommentsApiService.createComment(request);
},
@ -26,6 +27,7 @@ export const createCommentMutationAtom = atomWithMutation(() => ({
}));
export const createReplyMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: CreateReplyRequest & { message_id: number }) => {
return chatCommentsApiService.createReply(request);
},
@ -41,6 +43,7 @@ export const createReplyMutationAtom = atomWithMutation(() => ({
}));
export const updateCommentMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: UpdateCommentRequest & { message_id: number }) => {
return chatCommentsApiService.updateComment(request);
},
@ -56,6 +59,7 @@ export const updateCommentMutationAtom = atomWithMutation(() => ({
}));
export const deleteCommentMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: DeleteCommentRequest & { message_id: number }) => {
return chatCommentsApiService.deleteComment(request);
},

View file

@ -97,9 +97,7 @@ export const mentionedDocumentIdsAtom = atom((get) => {
surfsense_doc_ids: docs
.filter((doc) => doc.document_type === "SURFSENSE_DOCS")
.map((doc) => doc.id),
document_ids: docs
.filter((doc) => doc.document_type !== "SURFSENSE_DOCS")
.map((doc) => doc.id),
document_ids: docs.filter((doc) => doc.document_type !== "SURFSENSE_DOCS").map((doc) => doc.id),
folder_ids: folders.map((f) => f.id),
};
});

View file

@ -21,6 +21,7 @@ export const createImageGenConfigMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["image-gen-configs", "create"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: CreateImageGenConfigRequest) => {
return imageGenConfigApiService.createConfig(request);
@ -45,6 +46,7 @@ export const updateImageGenConfigMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["image-gen-configs", "update"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: UpdateImageGenConfigRequest) => {
return imageGenConfigApiService.updateConfig(request);
@ -72,6 +74,7 @@ export const deleteImageGenConfigMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["image-gen-configs", "delete"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: { id: number; name: string }) => {
return imageGenConfigApiService.deleteConfig(request.id);

View file

@ -14,6 +14,7 @@ import { queryClient } from "@/lib/query-client/client";
* Mutation atom for creating an invite
*/
export const createInviteMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: CreateInviteRequest) => {
return invitesApiService.createInvite(request);
},
@ -33,6 +34,7 @@ export const createInviteMutationAtom = atomWithMutation(() => ({
* Mutation atom for updating an invite
*/
export const updateInviteMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: UpdateInviteRequest) => {
return invitesApiService.updateInvite(request);
},
@ -52,6 +54,7 @@ export const updateInviteMutationAtom = atomWithMutation(() => ({
* Mutation atom for deleting an invite
*/
export const deleteInviteMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: DeleteInviteRequest) => {
return invitesApiService.deleteInvite(request);
},
@ -71,6 +74,7 @@ export const deleteInviteMutationAtom = atomWithMutation(() => ({
* Mutation atom for accepting an invite
*/
export const acceptInviteMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: AcceptInviteRequest) => {
return invitesApiService.acceptInvite(request);
},

View file

@ -19,10 +19,8 @@ export const createLogMutationAtom = atomWithMutation((get) => {
enabled: !!searchSpaceId,
mutationFn: async (request: CreateLogRequest) => logsApiService.createLog(request),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: cacheKeys.logs.list(searchSpaceId ?? undefined) });
queryClient.invalidateQueries({
queryKey: cacheKeys.logs.summary(searchSpaceId ?? undefined),
});
// Invalidate all log-related queries (list, summary, detail, withQueryParams)
queryClient.invalidateQueries({ queryKey: ["logs"] });
},
};
});
@ -38,11 +36,7 @@ export const updateLogMutationAtom = atomWithMutation((get) => {
mutationFn: async ({ logId, data }: { logId: number; data: UpdateLogRequest }) =>
logsApiService.updateLog(logId, data),
onSuccess: (_data, variables) => {
queryClient.invalidateQueries({ queryKey: cacheKeys.logs.detail(variables.logId) });
queryClient.invalidateQueries({ queryKey: cacheKeys.logs.list(searchSpaceId ?? undefined) });
queryClient.invalidateQueries({
queryKey: cacheKeys.logs.summary(searchSpaceId ?? undefined),
});
queryClient.invalidateQueries({ queryKey: ["logs"] });
},
};
});
@ -57,12 +51,7 @@ export const deleteLogMutationAtom = atomWithMutation((get) => {
enabled: !!searchSpaceId,
mutationFn: async (request: DeleteLogRequest) => logsApiService.deleteLog(request),
onSuccess: (_data, request) => {
queryClient.invalidateQueries({ queryKey: cacheKeys.logs.list(searchSpaceId ?? undefined) });
queryClient.invalidateQueries({
queryKey: cacheKeys.logs.summary(searchSpaceId ?? undefined),
});
if (request?.id)
queryClient.invalidateQueries({ queryKey: cacheKeys.logs.detail(request.id) });
queryClient.invalidateQueries({ queryKey: ["logs"] });
},
};
});

View file

@ -14,6 +14,7 @@ import { queryClient } from "@/lib/query-client/client";
export const updateMemberMutationAtom = atomWithMutation(() => {
return {
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: UpdateMembershipRequest) => {
return membersApiService.updateMember(request);
},
@ -31,6 +32,7 @@ export const updateMemberMutationAtom = atomWithMutation(() => {
export const deleteMemberMutationAtom = atomWithMutation(() => {
return {
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: DeleteMembershipRequest) => {
return membersApiService.deleteMember(request);
},
@ -48,6 +50,7 @@ export const deleteMemberMutationAtom = atomWithMutation(() => {
export const leaveSearchSpaceMutationAtom = atomWithMutation(() => {
return {
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: LeaveSearchSpaceRequest) => {
return membersApiService.leaveSearchSpace(request);
},

View file

@ -23,6 +23,7 @@ export const createNewLLMConfigMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["new-llm-configs", "create"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: CreateNewLLMConfigRequest) => {
return newLLMConfigApiService.createConfig(request);
@ -47,6 +48,7 @@ export const updateNewLLMConfigMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["new-llm-configs", "update"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: UpdateNewLLMConfigRequest) => {
return newLLMConfigApiService.updateConfig(request);
@ -74,6 +76,7 @@ export const deleteNewLLMConfigMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["new-llm-configs", "delete"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: DeleteNewLLMConfigRequest & { name: string }) => {
return newLLMConfigApiService.deleteConfig({ id: request.id });
@ -105,6 +108,7 @@ export const updateLLMPreferencesMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["llm-preferences", "update"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: UpdateLLMPreferencesRequest) => {
return newLLMConfigApiService.updateLLMPreferences(request);

View file

@ -11,6 +11,7 @@ import { queryClient } from "@/lib/query-client/client";
export const createPromptMutationAtom = atomWithMutation(() => ({
mutationKey: ["prompts", "create"],
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: PromptCreateRequest) => {
return promptsApiService.create(request);
},
@ -25,6 +26,7 @@ export const createPromptMutationAtom = atomWithMutation(() => ({
export const updatePromptMutationAtom = atomWithMutation(() => ({
mutationKey: ["prompts", "update"],
meta: { suppressGlobalErrorToast: true },
mutationFn: async ({ id, ...data }: PromptUpdateRequest & { id: number }) => {
return promptsApiService.update(id, data);
},
@ -39,6 +41,7 @@ export const updatePromptMutationAtom = atomWithMutation(() => ({
export const deletePromptMutationAtom = atomWithMutation(() => ({
mutationKey: ["prompts", "delete"],
meta: { suppressGlobalErrorToast: true },
mutationFn: async (id: number) => {
return promptsApiService.delete(id);
},
@ -57,6 +60,7 @@ export const deletePromptMutationAtom = atomWithMutation(() => ({
export const copyPromptMutationAtom = atomWithMutation(() => ({
mutationKey: ["prompts", "copy"],
meta: { suppressGlobalErrorToast: true },
mutationFn: async (promptId: number) => {
return promptsApiService.copy(promptId);
},

View file

@ -10,6 +10,7 @@ import { cacheKeys } from "@/lib/query-client/cache-keys";
import { queryClient } from "@/lib/query-client/client";
export const createPublicChatSnapshotMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: PublicChatSnapshotCreateRequest) => {
return chatThreadsApiService.createPublicChatSnapshot(request);
},
@ -37,6 +38,7 @@ export const createPublicChatSnapshotMutationAtom = atomWithMutation(() => ({
}));
export const deletePublicChatSnapshotMutationAtom = atomWithMutation(() => ({
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: PublicChatSnapshotDeleteRequest) => {
return chatThreadsApiService.deletePublicChatSnapshot(request);
},

View file

@ -14,6 +14,7 @@ import { queryClient } from "@/lib/query-client/client";
export const createRoleMutationAtom = atomWithMutation(() => {
return {
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: CreateRoleRequest) => {
return rolesApiService.createRole(request);
},
@ -31,6 +32,7 @@ export const createRoleMutationAtom = atomWithMutation(() => {
export const updateRoleMutationAtom = atomWithMutation(() => {
return {
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: UpdateRoleRequest) => {
return rolesApiService.updateRole(request);
},
@ -54,6 +56,7 @@ export const updateRoleMutationAtom = atomWithMutation(() => {
export const deleteRoleMutationAtom = atomWithMutation(() => {
return {
meta: { suppressGlobalErrorToast: true },
mutationFn: async (request: DeleteRoleRequest) => {
return rolesApiService.deleteRole(request);
},

View file

@ -18,6 +18,7 @@ export const createVisionLLMConfigMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["vision-llm-configs", "create"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: CreateVisionLLMConfigRequest) => {
return visionLLMConfigApiService.createConfig(request);
@ -39,6 +40,7 @@ export const updateVisionLLMConfigMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["vision-llm-configs", "update"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: UpdateVisionLLMConfigRequest) => {
return visionLLMConfigApiService.updateConfig(request);
@ -63,6 +65,7 @@ export const deleteVisionLLMConfigMutationAtom = atomWithMutation((get) => {
return {
mutationKey: ["vision-llm-configs", "delete"],
meta: { suppressGlobalErrorToast: true },
enabled: !!searchSpaceId,
mutationFn: async (request: { id: number; name: string }) => {
return visionLLMConfigApiService.deleteConfig(request.id);