Skip to content

Commit

Permalink
Revert "feat: remove public endpoint"
Browse files Browse the repository at this point in the history
This reverts commit 931cb80.
  • Loading branch information
darkskygit committed Apr 2, 2024
1 parent 27a2b36 commit 2328ea0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/backend/server/src/plugins/copilot/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,16 @@ export class CopilotResolver {
description: 'Create a chat message',
})
async createCopilotMessage(
@CurrentUser() user: CurrentUser,
@CurrentUser() user: CurrentUser | undefined,
@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 2328ea0

Please sign in to comment.