> */ public function getAvailable(): array { $collections = $this->repository->getSearchable(); if ($collections === []) { return [ ['collection_id' => 'documents', 'display_name' => 'Dokumente', 'points_count' => 0, 'vector_size' => 1024], ]; } return $collections; } /** * Validate and filter collections against available ones. * * @param array $collections * @return array */ public function validate(array $collections): array { $availableIds = array_column($this->getAvailable(), 'collection_id'); $valid = array_filter($collections, fn ($c) => in_array($c, $availableIds, true)); return array_values($valid); } /** * Check if collections are compatible (same vector dimensions). * * @param array $collectionIds * @return array{valid: bool, error: string|null} */ public function checkCompatibility(array $collectionIds): array { if (empty($collectionIds)) { return ['valid' => true, 'error' => null]; } $result = $this->validator->validateSelection($collectionIds); return [ 'valid' => $result->isValid(), 'error' => $result->getError(), ]; } /** * Validate collections and check compatibility in one call. * * @param array $collections * @return array{collections: array, valid: bool, error: string|null} */ public function validateWithCompatibility(array $collections): array { $validated = $this->validate($collections); if (empty($validated)) { return [ 'collections' => [], 'valid' => false, 'error' => 'Keine gültigen Collections ausgewählt', ]; } $compatibility = $this->checkCompatibility($validated); return [ 'collections' => $validated, 'valid' => $compatibility['valid'], 'error' => $compatibility['error'], ]; } }