mirror of
https://github.com/docmost/docmost.git
synced 2026-08-19 18:44:09 +08:00
feat(ai): warm the vector namespace cache on session start
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
Post,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { UserService } from './user.service';
|
||||
import { UpdateUserDto } from './dto/update-user.dto';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
@@ -13,6 +14,7 @@ import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import { WorkspaceRepo } from '@docmost/db/repos/workspace/workspace.repo';
|
||||
import { EventName } from '../../common/events/event.contants';
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Controller('users')
|
||||
@@ -20,6 +22,7 @@ export class UserController {
|
||||
constructor(
|
||||
private readonly userService: UserService,
|
||||
private readonly workspaceRepo: WorkspaceRepo,
|
||||
private readonly eventEmitter: EventEmitter2,
|
||||
) {}
|
||||
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@@ -39,6 +42,11 @@ export class UserController {
|
||||
memberCount,
|
||||
};
|
||||
|
||||
this.eventEmitter.emit(EventName.USER_SESSION_STARTED, {
|
||||
userId: authUser.id,
|
||||
workspaceId: workspace.id,
|
||||
});
|
||||
|
||||
return { user: authUser, workspace: workspaceInfo };
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule apps/server/src/ee updated: 26030bdd71...9b999c687f
Reference in New Issue
Block a user