fix: gql result check for clean history (#7154)

This commit is contained in:
darkskygit
2024-06-05 07:49:40 +00:00
parent ecff441516
commit a5f9bfdda9
3 changed files with 18 additions and 19 deletions
@@ -514,24 +514,24 @@ export class ChatSessionService {
// only mark action session as deleted
// chat session always can be reuse
{
const actionIds = (
await Promise.all(
sessions.map(({ id, promptName }) =>
this.prompt
.get(promptName)
.then(prompt => ({ id, action: !!prompt?.action }))
)
const actionIds = (
await Promise.all(
sessions.map(({ id, promptName }) =>
this.prompt
.get(promptName)
.then(prompt => ({ id, action: !!prompt?.action }))
)
)
.filter(({ action }) => action)
.map(({ id }) => id);
)
.filter(({ action }) => action)
.map(({ id }) => id);
await tx.aiSession.updateMany({
where: { id: { in: actionIds } },
data: { deletedAt: new Date() },
});
}
await tx.aiSession.updateMany({
where: { id: { in: actionIds } },
data: { deletedAt: new Date() },
});
return [...sessionIds, ...actionIds];
});
}