mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 09:36:17 +08:00
feat(server): add generate title cron resolver (#13189)
fix AI-350 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a new option to manually trigger the generation of missing session titles via a GraphQL query. * **Improvements** * The process for generating missing session titles now considers all eligible sessions, without limiting the number processed at a time. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -613,7 +613,7 @@ export class CopilotSessionModel extends BaseModel {
|
||||
}
|
||||
|
||||
@Transactional()
|
||||
async toBeGenerateTitle(take: number) {
|
||||
async toBeGenerateTitle() {
|
||||
const sessions = await this.db.aiSession
|
||||
.findMany({
|
||||
where: {
|
||||
@@ -628,7 +628,6 @@ export class CopilotSessionModel extends BaseModel {
|
||||
// count assistant messages
|
||||
_count: { select: { messages: { where: { role: 'assistant' } } } },
|
||||
},
|
||||
take,
|
||||
orderBy: { updatedAt: 'desc' },
|
||||
})
|
||||
.then(s => s.filter(s => s._count.messages > 0));
|
||||
|
||||
Reference in New Issue
Block a user