Files
gitmost/apps/server/src/core/ai-chat/ai-chat.module.ts
vvzvlad 0c46f60ddf Merge gitea/develop into feat/public-share-assistant
Resolve conflicts with the independently-merged ai-agent-roles feature:
- ai-chat.module.ts: keep BOTH AiAgentRolesModule and the public-share
  wiring (Share/Search modules, PublicShareChatController, services).
- ai.service.ts: take develop's getChatModel ChatModelOverride superset,
  which already covers the public-share model-id-only override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 18:40:58 +03:00

52 lines
2.1 KiB
TypeScript

import { Module } from '@nestjs/common';
import { AiModule } from '../../integrations/ai/ai.module';
import { TokenModule } from '../auth/token.module';
import { AiChatController } from './ai-chat.controller';
import { AiChatService } from './ai-chat.service';
import { AiTranscriptionService } from './ai-transcription.service';
import { AiChatToolsService } from './tools/ai-chat-tools.service';
import { EmbeddingModule } from './embedding/embedding.module';
import { ExternalMcpModule } from './external-mcp/external-mcp.module';
import { AiAgentRolesModule } from './roles/ai-agent-roles.module';
import { ShareModule } from '../share/share.module';
import { SearchModule } from '../search/search.module';
import { PublicShareChatController } from './public-share-chat.controller';
import { PublicShareChatService } from './public-share-chat.service';
import { PublicShareChatToolsService } from './tools/public-share-chat-tools.service';
/**
* Per-user AI chat module (§6.1).
*
* AiModule supplies AiService + AiSettingsService. TokenModule supplies
* TokenService for minting the per-user loopback access token (§15[C1]). The
* AiChatRepo / AiChatMessageRepo / PageEmbeddingRepo / SpaceMemberRepo /
* PagePermissionRepo come from the global DatabaseModule; the UserThrottlerGuard
* + AI_CHAT throttler come from the global ThrottleModule registered in
* AppModule. EmbeddingModule hosts the vector-RAG indexer + AI_QUEUE consumer
* (§6.7 stage D); importing it here boots the processor with the app.
*
* ShareModule (ShareService) + SearchModule (SearchService) are imported for the
* ANONYMOUS public-share assistant (PublicShareChatController), whose read-only
* tools scope every lookup to a single share tree.
*/
@Module({
imports: [
AiModule,
TokenModule,
EmbeddingModule,
ExternalMcpModule,
AiAgentRolesModule,
ShareModule,
SearchModule,
],
controllers: [AiChatController, PublicShareChatController],
providers: [
AiChatService,
AiTranscriptionService,
AiChatToolsService,
PublicShareChatService,
PublicShareChatToolsService,
],
})
export class AiChatModule {}