Files
nc-talk-ai/lib/Jobs/CleanupRoomDocumentsJob.php
T
Pascal Kienast 0739d3da6a Initial open-source release of Talk AI
Talk AI is a multi-bot AI assistant manager for Nextcloud Talk:
per-bot prompts and models, agentic tool calling (MCP + built-in
tools), RAG over Nextcloud files, room-document search, vision and
speech-to-text attachments, persistent bot wikis, approval workflows,
rate limiting, and multi-provider LLM support (any OpenAI-compatible
endpoint).

Developed within EDUC - the European Digital UniverCity
(https://educalliance.eu), where it runs as the 'EDUC AI' assistant on
the alliance-wide Nextcloud portal. This public repository is the
upstream point of truth; deployment-specific tools plug in via the
tool-provider extension point (docs/TOOL_PROVIDERS.md).

License: AGPL-3.0-or-later.
2026-07-08 21:13:13 +02:00

51 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace OCA\EducAI\Jobs;
use OCA\EducAI\Service\RoomDocumentIngestionService;
use OCA\EducAI\Service\RoomImageIngestionService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use Psr\Log\LoggerInterface;
class CleanupRoomDocumentsJob extends TimedJob {
private RoomDocumentIngestionService $roomDocumentIngestionService;
private RoomImageIngestionService $roomImageIngestionService;
private LoggerInterface $logger;
public function __construct(
ITimeFactory $time,
RoomDocumentIngestionService $roomDocumentIngestionService,
RoomImageIngestionService $roomImageIngestionService,
LoggerInterface $logger
) {
parent::__construct($time);
$this->roomDocumentIngestionService = $roomDocumentIngestionService;
$this->roomImageIngestionService = $roomImageIngestionService;
$this->logger = $logger;
$this->setInterval(86400);
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
}
/**
* @param array<string,mixed> $arguments
*/
protected function run($arguments): void {
try {
$deleted = $this->roomDocumentIngestionService->cleanupStaleDocuments();
$deletedImages = $this->roomImageIngestionService->cleanupStaleImages();
$this->logger->info('EducAI: Cleaned up stale room documents and images', [
'deleted_documents' => $deleted,
'deleted_images' => $deletedImages,
]);
} catch (\Throwable $e) {
$this->logger->error('EducAI: Failed to cleanup room documents/images', [
'exception' => $e,
]);
}
}
}