There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(server): nullable value for parent id (#10725)
darkskygit10605b379397
diff --git a/packages/backend/server/src/plugins/copilot/context/resolver.ts b/packages/backend/server/src/plugins/copilot/context/resolver.tsindex 7ba20a2367..d585486e62 100644--- a/packages/backend/server/src/plugins/copilot/context/resolver.ts+++ b/packages/backend/server/src/plugins/copilot/context/resolver.ts@@ -146,7 +146,11 @@ export class CopilotContextRootResolver {if (!lock) {return new TooManyRequest('Server is busy');}- await this.checkChatSession(user, sessionId, copilot.workspaceId);+ await this.checkChatSession(+ user,+ sessionId,+ copilot.workspaceId || undefined+ );if (contextId) {const context = await this.context.get(contextId);diff --git a/packages/backend/server/src/plugins/copilot/resolver.ts b/packages/backend/server/src/plugins/copilot/resolver.tsindex fc9c916a77..7c9703b760 100644--- a/packages/backend/server/src/plugins/copilot/resolver.ts+++ b/packages/backend/server/src/plugins/copilot/resolver.ts@@ -196,7 +196,7 @@ class CopilotHistoriesType implements Partial<ChatHistory> {description: 'An mark identifying which view to use to display the session',nullable: true,})- action!: string | undefined;+ action!: string | null;@Field(() => Number, {description: 'The number of tokens used in the session',@@ -281,7 +281,7 @@ class CopilotSessionType {id!: string;@Field(() => ID, { nullable: true })- parentSessionId!: string | undefined;+ parentSessionId!: string | null;@Field(() => String)promptName!: string;@@ -292,10 +292,7 @@ class CopilotSessionType {@ObjectType('Copilot')export class CopilotType {@Field(() => ID, { nullable: true })- workspaceId!: string | undefined;-- @Field(() => ID, { nullable: true })- docId!: string | undefined;+ workspaceId!: string | null;}@Throttle()@@ -575,7 +572,7 @@ export class UserCopilotResolver {.allowLocal().assert('Workspace.Copilot');}- return { workspaceId };+ return { workspaceId: workspaceId || null };}}diff --git a/packages/backend/server/src/plugins/copilot/session.ts b/packages/backend/server/src/plugins/copilot/session.tsindex 94ec7bea38..cdbedf0cdf 100644--- a/packages/backend/server/src/plugins/copilot/session.ts+++ b/packages/backend/server/src/plugins/copilot/session.ts@@ -409,7 +409,7 @@ export class ChatSessionService {): Promise<Array<{id: string;- parentSessionId?: string;+ parentSessionId: string | null;promptName: string;}>> {@@ -433,7 +433,7 @@ export class ChatSessionService {.then(sessions =>sessions.map(({ id, parentSessionId, promptName }) => ({id,- parentSessionId: parentSessionId || undefined,+ parentSessionId: parentSessionId || null,promptName,})));@@ -548,7 +548,7 @@ export class ChatSessionService {return {sessionId: id,- action: prompt.action || undefined,+ action: prompt.action || null,tokens: tokenCost,createdAt,messages: preload.concat(ret.data),diff --git a/packages/backend/server/src/plugins/copilot/types.ts b/packages/backend/server/src/plugins/copilot/types.tsindex 9070b406e8..a8ee21e12f 100644--- a/packages/backend/server/src/plugins/copilot/types.ts+++ b/packages/backend/server/src/plugins/copilot/types.ts@@ -101,7 +101,7 @@ export type SubmittedMessage = z.infer<typeof SubmittedMessageSchema>;export const ChatHistorySchema = z.object({sessionId: z.string(),- action: z.string().optional(),+ action: z.string().nullable(),tokens: z.number(),messages: z.array(PromptMessageSchema.or(ChatMessageSchema)),createdAt: z.date(),diff --git a/packages/backend/server/src/schema.gql b/packages/backend/server/src/schema.gqlindex 57b0c723eb..7893a47391 100644--- a/packages/backend/server/src/schema.gql+++ b/packages/backend/server/src/schema.gql@@ -39,7 +39,6 @@ enum ContextFileStatus {type Copilot {"""Get the context list of a session"""contexts(contextId: String, sessionId: String!): [CopilotContext!]!- docId: IDhistories(docId: String, options: QueryChatHistoriesInput): [CopilotHistories!]!"""Get the quota of the user in the workspace"""diff --git a/packages/frontend/graphql/src/schema.ts b/packages/frontend/graphql/src/schema.tsindex 4c9e1774e3..3d6870d972 100644--- a/packages/frontend/graphql/src/schema.ts+++ b/packages/frontend/graphql/src/schema.ts@@ -78,7 +78,6 @@ export interface Copilot {__typename?: 'Copilot';/** Get the context list of a session */contexts: Array<CopilotContext>;- docId: Maybe<Scalars['ID']['output']>;histories: Array<CopilotHistories>;/** Get the quota of the user in the workspace */quota: CopilotQuota;