mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
feat: filter out session create request for root doc (#10187)
This commit is contained in:
@@ -21,6 +21,7 @@ import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs';
|
||||
|
||||
import {
|
||||
CallMetric,
|
||||
CopilotDocNotFound,
|
||||
CopilotFailedToCreateMessage,
|
||||
CopilotSessionNotFound,
|
||||
type FileUpload,
|
||||
@@ -381,6 +382,11 @@ export class CopilotResolver {
|
||||
return new TooManyRequest('Server is busy');
|
||||
}
|
||||
|
||||
if (options.workspaceId === options.docId) {
|
||||
// filter out session create request for root doc
|
||||
throw new CopilotDocNotFound({ docId: options.docId });
|
||||
}
|
||||
|
||||
await this.chatSession.checkQuota(user.id);
|
||||
|
||||
return await this.chatSession.create({
|
||||
@@ -443,6 +449,11 @@ export class CopilotResolver {
|
||||
return new TooManyRequest('Server is busy');
|
||||
}
|
||||
|
||||
if (options.workspaceId === options.docId) {
|
||||
// filter out session create request for root doc
|
||||
throw new CopilotDocNotFound({ docId: options.docId });
|
||||
}
|
||||
|
||||
await this.chatSession.checkQuota(user.id);
|
||||
|
||||
return await this.chatSession.fork({
|
||||
|
||||
Reference in New Issue
Block a user