chore(server): return parent id of sessions (#10638)

This commit is contained in:
darkskygit
2025-03-05 14:03:36 +00:00
parent 43ded6aa38
commit fbb6df3da8
7 changed files with 92 additions and 18 deletions

View File

@@ -280,6 +280,9 @@ class CopilotSessionType {
@Field(() => ID)
id!: string;
@Field(() => ID, { nullable: true })
parentSessionId!: string | undefined;
@Field(() => String)
promptName!: string;
}

View File

@@ -401,7 +401,13 @@ export class ChatSessionService {
workspaceId: string,
docId?: string,
options?: { action?: boolean }
): Promise<Array<{ id: string; promptName: string }>> {
): Promise<
Array<{
id: string;
parentSessionId?: string;
promptName: string;
}>
> {
return await this.db.aiSession
.findMany({
where: {
@@ -415,12 +421,14 @@ export class ChatSessionService {
},
select: {
id: true,
parentSessionId: true,
promptName: true,
},
})
.then(sessions =>
sessions.map(({ id, promptName }) => ({
sessions.map(({ id, parentSessionId, promptName }) => ({
id,
parentSessionId: parentSessionId || undefined,
promptName,
}))
);

View File

@@ -197,6 +197,7 @@ type CopilotQuota {
type CopilotSessionType {
id: ID!
parentSessionId: ID
promptName: String!
}