feat(server): stop embedding in doc embedding disabled workspace (#11761)

fix AI-33
This commit is contained in:
darkskygit
2025-04-17 09:57:33 +00:00
parent e577bb7aa9
commit 570dc79e3d
8 changed files with 50 additions and 1 deletions

View File

@@ -701,6 +701,10 @@ export const USER_FRIENDLY_ERRORS = {
message: ({ contextId, content, message }) =>
`Failed to match context ${contextId} with "${escape(content)}": ${message}`,
},
copilot_embedding_disabled: {
type: 'action_forbidden',
message: `Embedding feature is disabled, please contact the administrator to enable it in the workspace settings.`,
},
copilot_embedding_unavailable: {
type: 'action_forbidden',
message: `Embedding feature not available, you may need to install pgvector extension to your database`,

View File

@@ -759,6 +759,12 @@ export class CopilotFailedToMatchContext extends UserFriendlyError {
}
}
export class CopilotEmbeddingDisabled extends UserFriendlyError {
constructor(message?: string) {
super('action_forbidden', 'copilot_embedding_disabled', message);
}
}
export class CopilotEmbeddingUnavailable extends UserFriendlyError {
constructor(message?: string) {
super('action_forbidden', 'copilot_embedding_unavailable', message);
@@ -1037,6 +1043,7 @@ export enum ErrorNames {
COPILOT_CONTEXT_FILE_NOT_SUPPORTED,
COPILOT_FAILED_TO_MODIFY_CONTEXT,
COPILOT_FAILED_TO_MATCH_CONTEXT,
COPILOT_EMBEDDING_DISABLED,
COPILOT_EMBEDDING_UNAVAILABLE,
COPILOT_TRANSCRIPTION_JOB_EXISTS,
COPILOT_TRANSCRIPTION_JOB_NOT_FOUND,