feat(processing): ✨ Integrate response processing methods into ProcessingService and update module config for backend API
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
89dd63e2e6
commit
ce86e81a97
2 changed files with 13 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import { ProcessingController } from './processing.controller';
|
|||
import { ProcessingService } from './processing.service';
|
||||
|
||||
import { MessageEntity } from '@/entities';
|
||||
import { ResponsesModule } from '@/modules/responses';
|
||||
import { ScreeningModule } from '@/modules/screening';
|
||||
|
||||
@Module({
|
||||
|
|
@ -16,6 +17,7 @@ import { ScreeningModule } from '@/modules/screening';
|
|||
maxRedirects: 0,
|
||||
}),
|
||||
ScreeningModule,
|
||||
ResponsesModule,
|
||||
],
|
||||
controllers: [ProcessingController],
|
||||
providers: [ProcessingService],
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { Repository, IsNull } from 'typeorm';
|
|||
|
||||
import { MessageEntity, MessageType, RawMessageData } from '@/entities';
|
||||
import { ScreeningService } from '@/modules/screening/screening.service';
|
||||
import { ResponsesService } from '@/modules/responses/responses.service';
|
||||
|
||||
/** Base directory for attachment storage */
|
||||
const ATTACHMENTS_DIR = process.env.ATTACHMENTS_DIR || '/mnt/bigdisk/_/lilith-platform/features/conversation-assistant/attachments';
|
||||
|
|
@ -66,6 +67,8 @@ export class ProcessingService {
|
|||
private readonly httpService: HttpService,
|
||||
@Optional() @Inject(ScreeningService)
|
||||
private readonly screeningService?: ScreeningService,
|
||||
@Optional() @Inject(ResponsesService)
|
||||
private readonly responsesService?: ResponsesService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
|
|
@ -187,6 +190,14 @@ export class ProcessingService {
|
|||
this.logger.warn(`Screening failed for message ${message.id}: ${err instanceof Error ? err.message : 'Unknown'}`);
|
||||
});
|
||||
}
|
||||
|
||||
// Auto-generate response drafts for incoming messages from known contacts (non-blocking)
|
||||
if (text && text.length > 0 && message.direction === 'incoming' && message.senderId && this.responsesService) {
|
||||
this.responsesService.generateSuggestions(message.id, message.senderId)
|
||||
.catch((err) => {
|
||||
this.logger.warn(`Auto-draft failed for message ${message.id}: ${err instanceof Error ? err.message : 'Unknown'}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue