feat(server): global embedding gql endpoint (#11809)

fix AI-30
fix AI-31
fix PD-2487
This commit is contained in:
darkskygit
2025-04-23 11:25:40 +00:00
parent 5d9a3aac5b
commit 5397fba897
25 changed files with 665 additions and 60 deletions

View File

@@ -159,6 +159,10 @@ type CopilotDocType {
status: ContextEmbedStatus
}
type CopilotFailedToAddWorkspaceFileEmbeddingDataType {
message: String!
}
type CopilotFailedToMatchContextDataType {
content: String!
contextId: String!
@@ -268,6 +272,21 @@ type CopilotSessionType {
promptName: String!
}
type CopilotWorkspaceConfig {
files: [CopilotWorkspaceFile!]!
ignoredDocs: [String!]!
workspaceId: String!
}
type CopilotWorkspaceFile {
createdAt: DateTime!
fileId: String!
fileName: String!
mimeType: String!
size: SafeInt!
workspaceId: String!
}
input CreateChatMessageInput {
attachments: [String!]
blobs: [Upload!]
@@ -404,7 +423,7 @@ type EditorType {
name: String!
}
union ErrorDataUnion = AlreadyInSpaceDataType | BlobNotFoundDataType | CopilotContextFileNotSupportedDataType | CopilotDocNotFoundDataType | CopilotFailedToMatchContextDataType | CopilotFailedToModifyContextDataType | CopilotInvalidContextDataType | CopilotMessageNotFoundDataType | CopilotPromptNotFoundDataType | CopilotProviderSideErrorDataType | DocActionDeniedDataType | DocHistoryNotFoundDataType | DocNotFoundDataType | DocUpdateBlockedDataType | ExpectToGrantDocUserRolesDataType | ExpectToRevokeDocUserRolesDataType | ExpectToUpdateDocUserRoleDataType | GraphqlBadRequestDataType | HttpRequestErrorDataType | InvalidEmailDataType | InvalidHistoryTimestampDataType | InvalidLicenseUpdateParamsDataType | InvalidOauthCallbackCodeDataType | InvalidPasswordLengthDataType | InvalidRuntimeConfigTypeDataType | MemberNotFoundInSpaceDataType | MentionUserDocAccessDeniedDataType | MissingOauthQueryParameterDataType | NotInSpaceDataType | QueryTooLongDataType | RuntimeConfigNotFoundDataType | SameSubscriptionRecurringDataType | SpaceAccessDeniedDataType | SpaceNotFoundDataType | SpaceOwnerNotFoundDataType | SpaceShouldHaveOnlyOneOwnerDataType | SubscriptionAlreadyExistsDataType | SubscriptionNotExistsDataType | SubscriptionPlanNotFoundDataType | UnknownOauthProviderDataType | UnsupportedClientVersionDataType | UnsupportedSubscriptionPlanDataType | ValidationErrorDataType | VersionRejectedDataType | WorkspaceMembersExceedLimitToDowngradeDataType | WorkspacePermissionNotFoundDataType | WrongSignInCredentialsDataType
union ErrorDataUnion = AlreadyInSpaceDataType | BlobNotFoundDataType | CopilotContextFileNotSupportedDataType | CopilotDocNotFoundDataType | CopilotFailedToAddWorkspaceFileEmbeddingDataType | CopilotFailedToMatchContextDataType | CopilotFailedToModifyContextDataType | CopilotInvalidContextDataType | CopilotMessageNotFoundDataType | CopilotPromptNotFoundDataType | CopilotProviderSideErrorDataType | DocActionDeniedDataType | DocHistoryNotFoundDataType | DocNotFoundDataType | DocUpdateBlockedDataType | ExpectToGrantDocUserRolesDataType | ExpectToRevokeDocUserRolesDataType | ExpectToUpdateDocUserRoleDataType | GraphqlBadRequestDataType | HttpRequestErrorDataType | InvalidEmailDataType | InvalidHistoryTimestampDataType | InvalidLicenseUpdateParamsDataType | InvalidOauthCallbackCodeDataType | InvalidPasswordLengthDataType | InvalidRuntimeConfigTypeDataType | MemberNotFoundInSpaceDataType | MentionUserDocAccessDeniedDataType | MissingOauthQueryParameterDataType | NotInSpaceDataType | QueryTooLongDataType | RuntimeConfigNotFoundDataType | SameSubscriptionRecurringDataType | SpaceAccessDeniedDataType | SpaceNotFoundDataType | SpaceOwnerNotFoundDataType | SpaceShouldHaveOnlyOneOwnerDataType | SubscriptionAlreadyExistsDataType | SubscriptionNotExistsDataType | SubscriptionPlanNotFoundDataType | UnknownOauthProviderDataType | UnsupportedClientVersionDataType | UnsupportedSubscriptionPlanDataType | ValidationErrorDataType | VersionRejectedDataType | WorkspaceMembersExceedLimitToDowngradeDataType | WorkspacePermissionNotFoundDataType | WrongSignInCredentialsDataType
enum ErrorNames {
ACCESS_DENIED
@@ -427,6 +446,7 @@ enum ErrorNames {
COPILOT_DOC_NOT_FOUND
COPILOT_EMBEDDING_DISABLED
COPILOT_EMBEDDING_UNAVAILABLE
COPILOT_FAILED_TO_ADD_WORKSPACE_FILE_EMBEDDING
COPILOT_FAILED_TO_CREATE_MESSAGE
COPILOT_FAILED_TO_GENERATE_TEXT
COPILOT_FAILED_TO_MATCH_CONTEXT
@@ -907,6 +927,9 @@ type Mutation {
"""add a file to context"""
addContextFile(content: Upload!, options: AddContextFileInput!): CopilotContextFile!
"""Update workspace embedding files"""
addWorkspaceEmbeddingFiles(blob: Upload!, workspaceId: String!): CopilotWorkspaceFile!
addWorkspaceFeature(feature: FeatureType!, workspaceId: String!): Boolean!
approveMember(userId: String!, workspaceId: String!): Boolean!
@@ -995,6 +1018,9 @@ type Mutation {
"""remove a file from context"""
removeContextFile(options: RemoveContextFileInput!): Boolean!
"""Remove workspace embedding files"""
removeWorkspaceEmbeddingFiles(fileId: String!, workspaceId: String!): Boolean!
removeWorkspaceFeature(feature: FeatureType!, workspaceId: String!): Boolean!
resumeSubscription(idempotencyKey: String @deprecated(reason: "use header `Idempotency-Key`"), plan: SubscriptionPlan = Pro, workspaceId: String): SubscriptionType!
retryAudioTranscription(jobId: String!, workspaceId: String!): TranscriptionResultType
@@ -1037,6 +1063,9 @@ type Mutation {
"""Update workspace"""
updateWorkspace(input: UpdateWorkspaceInput!): WorkspaceType!
"""Update ignored docs"""
updateWorkspaceEmbeddingIgnoredDocs(add: [String!], remove: [String!], workspaceId: String!): Int!
"""Upload user avatar"""
uploadAvatar(avatar: Upload!): UserType!
verifyEmail(token: String!): Boolean!
@@ -1703,6 +1732,7 @@ type WorkspaceType {
"""Get get with given id"""
doc(docId: String!): DocType!
embedding: CopilotWorkspaceConfig!
"""Enable AI"""
enableAi: Boolean!