Skip to content

Commit

Permalink
feat: remove public endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Apr 2, 2024
1 parent af0b95f commit 931cb80
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/backend/server/src/plugins/copilot/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,10 @@ export class CopilotResolver {
description: 'Create a chat message',
})
async createCopilotMessage(
@CurrentUser() user: CurrentUser | undefined,
@CurrentUser() user: CurrentUser,
@Args({ name: 'options', type: () => CreateChatMessageInput })
options: CreateChatMessageInput
) {
// todo(@darkskygit): remove this after the feature is stable
const publishable = AFFiNE.featureFlags.copilotAuthorization;
if (!user && !publishable) {
return new ForbiddenException('Login required');
}

const lockFlag = `${COPILOT_LOCKER}:message:${user?.id}:${options.sessionId}`;
await using lock = await this.mutex.lock(lockFlag);
if (!lock) {
Expand Down

0 comments on commit 931cb80

Please sign in to comment.