feat(server): add all ignored docs endpoint (#11953)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added the ability to view a complete list of ignored documents for a workspace without pagination. - Introduced separate options to add or remove ignored documents from workspace embeddings. - Added a new query to fetch all ignored documents for a workspace, including document IDs and creation timestamps. - **Refactor** - Reorganized and clarified GraphQL mutations and queries related to managing ignored documents in workspace embeddings. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -31,6 +31,7 @@ import { MAX_EMBEDDABLE_SIZE } from '../types';
|
|||||||
import { CopilotWorkspaceService } from './service';
|
import { CopilotWorkspaceService } from './service';
|
||||||
import {
|
import {
|
||||||
CopilotWorkspaceFileType,
|
CopilotWorkspaceFileType,
|
||||||
|
CopilotWorkspaceIgnoredDocType,
|
||||||
PaginatedCopilotWorkspaceFileType,
|
PaginatedCopilotWorkspaceFileType,
|
||||||
PaginatedIgnoredDocsType,
|
PaginatedIgnoredDocsType,
|
||||||
} from './types';
|
} from './types';
|
||||||
@@ -90,6 +91,18 @@ export class CopilotWorkspaceEmbeddingConfigResolver {
|
|||||||
return paginate(ignoredDocs, 'createdAt', pagination, totalCount);
|
return paginate(ignoredDocs, 'createdAt', pagination, totalCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResolveField(() => [CopilotWorkspaceIgnoredDocType], {
|
||||||
|
complexity: 2,
|
||||||
|
})
|
||||||
|
async allIgnoredDocs(
|
||||||
|
@Parent() config: CopilotWorkspaceConfigType
|
||||||
|
): Promise<CopilotWorkspaceIgnoredDocType[]> {
|
||||||
|
const [ignoredDocs] = await this.copilotWorkspace.listIgnoredDocs(
|
||||||
|
config.workspaceId
|
||||||
|
);
|
||||||
|
|
||||||
|
return ignoredDocs;
|
||||||
|
}
|
||||||
@Mutation(() => Number, {
|
@Mutation(() => Number, {
|
||||||
name: 'updateWorkspaceEmbeddingIgnoredDocs',
|
name: 'updateWorkspaceEmbeddingIgnoredDocs',
|
||||||
complexity: 2,
|
complexity: 2,
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ type CopilotSessionType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CopilotWorkspaceConfig {
|
type CopilotWorkspaceConfig {
|
||||||
|
allIgnoredDocs: [CopilotWorkspaceIgnoredDoc!]!
|
||||||
files(pagination: PaginationInput!): PaginatedCopilotWorkspaceFileType!
|
files(pagination: PaginationInput!): PaginatedCopilotWorkspaceFileType!
|
||||||
ignoredDocs(pagination: PaginationInput!): PaginatedIgnoredDocsType!
|
ignoredDocs(pagination: PaginationInput!): PaginatedIgnoredDocsType!
|
||||||
workspaceId: String!
|
workspaceId: String!
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
mutation addWorkspaceEmbeddingIgnoredDocs($workspaceId: String!, $add: [String!]!) {
|
||||||
|
updateWorkspaceEmbeddingIgnoredDocs(workspaceId: $workspaceId, add: $add)
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
query getAllWorkspaceEmbeddingIgnoredDocs($workspaceId: String!) {
|
||||||
|
workspace(id: $workspaceId) {
|
||||||
|
embedding {
|
||||||
|
allIgnoredDocs {
|
||||||
|
docId
|
||||||
|
createdAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
mutation removeWorkspaceEmbeddingIgnoredDocs($workspaceId: String!, $remove: [String!]!) {
|
||||||
|
updateWorkspaceEmbeddingIgnoredDocs(workspaceId: $workspaceId, remove: $remove)
|
||||||
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
mutation updateWorkspaceEmbeddingIgnoredDocs($workspaceId: String!, $add: [String!], $remove: [String!]) {
|
|
||||||
updateWorkspaceEmbeddingIgnoredDocs(workspaceId: $workspaceId, add: $add, remove: $remove)
|
|
||||||
}
|
|
||||||
@@ -756,14 +756,6 @@ export const addWorkspaceEmbeddingFilesMutation = {
|
|||||||
file: true,
|
file: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const removeWorkspaceEmbeddingFilesMutation = {
|
|
||||||
id: 'removeWorkspaceEmbeddingFilesMutation' as const,
|
|
||||||
op: 'removeWorkspaceEmbeddingFiles',
|
|
||||||
query: `mutation removeWorkspaceEmbeddingFiles($workspaceId: String!, $fileId: String!) {
|
|
||||||
removeWorkspaceEmbeddingFiles(workspaceId: $workspaceId, fileId: $fileId)
|
|
||||||
}`,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getWorkspaceEmbeddingFilesQuery = {
|
export const getWorkspaceEmbeddingFilesQuery = {
|
||||||
id: 'getWorkspaceEmbeddingFilesQuery' as const,
|
id: 'getWorkspaceEmbeddingFilesQuery' as const,
|
||||||
op: 'getWorkspaceEmbeddingFiles',
|
op: 'getWorkspaceEmbeddingFiles',
|
||||||
@@ -791,6 +783,37 @@ export const getWorkspaceEmbeddingFilesQuery = {
|
|||||||
}`,
|
}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const removeWorkspaceEmbeddingFilesMutation = {
|
||||||
|
id: 'removeWorkspaceEmbeddingFilesMutation' as const,
|
||||||
|
op: 'removeWorkspaceEmbeddingFiles',
|
||||||
|
query: `mutation removeWorkspaceEmbeddingFiles($workspaceId: String!, $fileId: String!) {
|
||||||
|
removeWorkspaceEmbeddingFiles(workspaceId: $workspaceId, fileId: $fileId)
|
||||||
|
}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const addWorkspaceEmbeddingIgnoredDocsMutation = {
|
||||||
|
id: 'addWorkspaceEmbeddingIgnoredDocsMutation' as const,
|
||||||
|
op: 'addWorkspaceEmbeddingIgnoredDocs',
|
||||||
|
query: `mutation addWorkspaceEmbeddingIgnoredDocs($workspaceId: String!, $add: [String!]!) {
|
||||||
|
updateWorkspaceEmbeddingIgnoredDocs(workspaceId: $workspaceId, add: $add)
|
||||||
|
}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getAllWorkspaceEmbeddingIgnoredDocsQuery = {
|
||||||
|
id: 'getAllWorkspaceEmbeddingIgnoredDocsQuery' as const,
|
||||||
|
op: 'getAllWorkspaceEmbeddingIgnoredDocs',
|
||||||
|
query: `query getAllWorkspaceEmbeddingIgnoredDocs($workspaceId: String!) {
|
||||||
|
workspace(id: $workspaceId) {
|
||||||
|
embedding {
|
||||||
|
allIgnoredDocs {
|
||||||
|
docId
|
||||||
|
createdAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
};
|
||||||
|
|
||||||
export const getWorkspaceEmbeddingIgnoredDocsQuery = {
|
export const getWorkspaceEmbeddingIgnoredDocsQuery = {
|
||||||
id: 'getWorkspaceEmbeddingIgnoredDocsQuery' as const,
|
id: 'getWorkspaceEmbeddingIgnoredDocsQuery' as const,
|
||||||
op: 'getWorkspaceEmbeddingIgnoredDocs',
|
op: 'getWorkspaceEmbeddingIgnoredDocs',
|
||||||
@@ -815,15 +838,11 @@ export const getWorkspaceEmbeddingIgnoredDocsQuery = {
|
|||||||
}`,
|
}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateWorkspaceEmbeddingIgnoredDocsMutation = {
|
export const removeWorkspaceEmbeddingIgnoredDocsMutation = {
|
||||||
id: 'updateWorkspaceEmbeddingIgnoredDocsMutation' as const,
|
id: 'removeWorkspaceEmbeddingIgnoredDocsMutation' as const,
|
||||||
op: 'updateWorkspaceEmbeddingIgnoredDocs',
|
op: 'removeWorkspaceEmbeddingIgnoredDocs',
|
||||||
query: `mutation updateWorkspaceEmbeddingIgnoredDocs($workspaceId: String!, $add: [String!], $remove: [String!]) {
|
query: `mutation removeWorkspaceEmbeddingIgnoredDocs($workspaceId: String!, $remove: [String!]!) {
|
||||||
updateWorkspaceEmbeddingIgnoredDocs(
|
updateWorkspaceEmbeddingIgnoredDocs(workspaceId: $workspaceId, remove: $remove)
|
||||||
workspaceId: $workspaceId
|
|
||||||
add: $add
|
|
||||||
remove: $remove
|
|
||||||
)
|
|
||||||
}`,
|
}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -366,6 +366,7 @@ export interface CopilotSessionType {
|
|||||||
|
|
||||||
export interface CopilotWorkspaceConfig {
|
export interface CopilotWorkspaceConfig {
|
||||||
__typename?: 'CopilotWorkspaceConfig';
|
__typename?: 'CopilotWorkspaceConfig';
|
||||||
|
allIgnoredDocs: Array<CopilotWorkspaceIgnoredDoc>;
|
||||||
files: PaginatedCopilotWorkspaceFileType;
|
files: PaginatedCopilotWorkspaceFileType;
|
||||||
ignoredDocs: PaginatedIgnoredDocsType;
|
ignoredDocs: PaginatedIgnoredDocsType;
|
||||||
workspaceId: Scalars['String']['output'];
|
workspaceId: Scalars['String']['output'];
|
||||||
@@ -3273,16 +3274,6 @@ export type AddWorkspaceEmbeddingFilesMutation = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RemoveWorkspaceEmbeddingFilesMutationVariables = Exact<{
|
|
||||||
workspaceId: Scalars['String']['input'];
|
|
||||||
fileId: Scalars['String']['input'];
|
|
||||||
}>;
|
|
||||||
|
|
||||||
export type RemoveWorkspaceEmbeddingFilesMutation = {
|
|
||||||
__typename?: 'Mutation';
|
|
||||||
removeWorkspaceEmbeddingFiles: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type GetWorkspaceEmbeddingFilesQueryVariables = Exact<{
|
export type GetWorkspaceEmbeddingFilesQueryVariables = Exact<{
|
||||||
workspaceId: Scalars['String']['input'];
|
workspaceId: Scalars['String']['input'];
|
||||||
pagination: PaginationInput;
|
pagination: PaginationInput;
|
||||||
@@ -3318,6 +3309,45 @@ export type GetWorkspaceEmbeddingFilesQuery = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type RemoveWorkspaceEmbeddingFilesMutationVariables = Exact<{
|
||||||
|
workspaceId: Scalars['String']['input'];
|
||||||
|
fileId: Scalars['String']['input'];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export type RemoveWorkspaceEmbeddingFilesMutation = {
|
||||||
|
__typename?: 'Mutation';
|
||||||
|
removeWorkspaceEmbeddingFiles: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AddWorkspaceEmbeddingIgnoredDocsMutationVariables = Exact<{
|
||||||
|
workspaceId: Scalars['String']['input'];
|
||||||
|
add: Array<Scalars['String']['input']> | Scalars['String']['input'];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export type AddWorkspaceEmbeddingIgnoredDocsMutation = {
|
||||||
|
__typename?: 'Mutation';
|
||||||
|
updateWorkspaceEmbeddingIgnoredDocs: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetAllWorkspaceEmbeddingIgnoredDocsQueryVariables = Exact<{
|
||||||
|
workspaceId: Scalars['String']['input'];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export type GetAllWorkspaceEmbeddingIgnoredDocsQuery = {
|
||||||
|
__typename?: 'Query';
|
||||||
|
workspace: {
|
||||||
|
__typename?: 'WorkspaceType';
|
||||||
|
embedding: {
|
||||||
|
__typename?: 'CopilotWorkspaceConfig';
|
||||||
|
allIgnoredDocs: Array<{
|
||||||
|
__typename?: 'CopilotWorkspaceIgnoredDoc';
|
||||||
|
docId: string;
|
||||||
|
createdAt: string;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export type GetWorkspaceEmbeddingIgnoredDocsQueryVariables = Exact<{
|
export type GetWorkspaceEmbeddingIgnoredDocsQueryVariables = Exact<{
|
||||||
workspaceId: Scalars['String']['input'];
|
workspaceId: Scalars['String']['input'];
|
||||||
pagination: PaginationInput;
|
pagination: PaginationInput;
|
||||||
@@ -3350,17 +3380,12 @@ export type GetWorkspaceEmbeddingIgnoredDocsQuery = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdateWorkspaceEmbeddingIgnoredDocsMutationVariables = Exact<{
|
export type RemoveWorkspaceEmbeddingIgnoredDocsMutationVariables = Exact<{
|
||||||
workspaceId: Scalars['String']['input'];
|
workspaceId: Scalars['String']['input'];
|
||||||
add?: InputMaybe<
|
remove: Array<Scalars['String']['input']> | Scalars['String']['input'];
|
||||||
Array<Scalars['String']['input']> | Scalars['String']['input']
|
|
||||||
>;
|
|
||||||
remove?: InputMaybe<
|
|
||||||
Array<Scalars['String']['input']> | Scalars['String']['input']
|
|
||||||
>;
|
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type UpdateWorkspaceEmbeddingIgnoredDocsMutation = {
|
export type RemoveWorkspaceEmbeddingIgnoredDocsMutation = {
|
||||||
__typename?: 'Mutation';
|
__typename?: 'Mutation';
|
||||||
updateWorkspaceEmbeddingIgnoredDocs: number;
|
updateWorkspaceEmbeddingIgnoredDocs: number;
|
||||||
};
|
};
|
||||||
@@ -4628,6 +4653,11 @@ export type Queries =
|
|||||||
variables: GetWorkspaceEmbeddingFilesQueryVariables;
|
variables: GetWorkspaceEmbeddingFilesQueryVariables;
|
||||||
response: GetWorkspaceEmbeddingFilesQuery;
|
response: GetWorkspaceEmbeddingFilesQuery;
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
name: 'getAllWorkspaceEmbeddingIgnoredDocsQuery';
|
||||||
|
variables: GetAllWorkspaceEmbeddingIgnoredDocsQueryVariables;
|
||||||
|
response: GetAllWorkspaceEmbeddingIgnoredDocsQuery;
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
name: 'getWorkspaceEmbeddingIgnoredDocsQuery';
|
name: 'getWorkspaceEmbeddingIgnoredDocsQuery';
|
||||||
variables: GetWorkspaceEmbeddingIgnoredDocsQueryVariables;
|
variables: GetWorkspaceEmbeddingIgnoredDocsQueryVariables;
|
||||||
@@ -5001,9 +5031,14 @@ export type Mutations =
|
|||||||
response: RemoveWorkspaceEmbeddingFilesMutation;
|
response: RemoveWorkspaceEmbeddingFilesMutation;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
name: 'updateWorkspaceEmbeddingIgnoredDocsMutation';
|
name: 'addWorkspaceEmbeddingIgnoredDocsMutation';
|
||||||
variables: UpdateWorkspaceEmbeddingIgnoredDocsMutationVariables;
|
variables: AddWorkspaceEmbeddingIgnoredDocsMutationVariables;
|
||||||
response: UpdateWorkspaceEmbeddingIgnoredDocsMutation;
|
response: AddWorkspaceEmbeddingIgnoredDocsMutation;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
name: 'removeWorkspaceEmbeddingIgnoredDocsMutation';
|
||||||
|
variables: RemoveWorkspaceEmbeddingIgnoredDocsMutationVariables;
|
||||||
|
response: RemoveWorkspaceEmbeddingIgnoredDocsMutation;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
name: 'createCheckoutSessionMutation';
|
name: 'createCheckoutSessionMutation';
|
||||||
|
|||||||
Reference in New Issue
Block a user