mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix: forked session query condition (#7568)
This commit is contained in:
@@ -194,6 +194,12 @@ export class ChatSessionService {
|
||||
|
||||
// find existing session if session is chat session
|
||||
if (!state.prompt.action) {
|
||||
const extraCondition: Record<string, any> = {};
|
||||
if (state.parentSessionId) {
|
||||
// also check session id if provided session is forked session
|
||||
extraCondition.id = state.sessionId;
|
||||
extraCondition.parentSessionId = state.parentSessionId;
|
||||
}
|
||||
const { id, deletedAt } =
|
||||
(await tx.aiSession.findFirst({
|
||||
where: {
|
||||
@@ -201,7 +207,8 @@ export class ChatSessionService {
|
||||
workspaceId: state.workspaceId,
|
||||
docId: state.docId,
|
||||
prompt: { action: { equals: null } },
|
||||
parentSessionId: state.parentSessionId,
|
||||
parentSessionId: null,
|
||||
...extraCondition,
|
||||
},
|
||||
select: { id: true, deletedAt: true },
|
||||
})) || {};
|
||||
|
||||
Reference in New Issue
Block a user