feat: filter out session create request for root doc (#10187)

This commit is contained in:
darkskygit
2025-02-14 11:14:56 +00:00
parent d111f8ac88
commit 42e0563d2e
4 changed files with 34 additions and 2 deletions

View File

@@ -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({