@@ -509,58 +509,6 @@ public function getOutputFilePreviewFile(string $userId, int $taskId, int $fileI
509
509
return $ this ->previewService ->getFilePreviewFile ($ taskOutputFile , $ x , $ y , $ realMime ?: null );
510
510
}
511
511
512
- /**
513
- * Sanitize inputs for storage based on the input type
514
- *
515
- * @param string $type
516
- * @param array $inputs
517
- * @return array
518
- * @throws \Exception
519
- */
520
- private function sanitizeInputs (string $ type , array $ inputs ): array {
521
- switch ($ type ) {
522
- case 'copywriter ' :
523
- {
524
- // Sanitize the input array based on the allowed keys and making sure all inputs are strings:
525
- $ inputs = array_filter ($ inputs , function ($ value , $ key ) {
526
- return in_array ($ key , ['writingStyle ' , 'sourceMaterial ' ]) && is_string ($ value );
527
- }, ARRAY_FILTER_USE_BOTH );
528
-
529
- if (count ($ inputs ) !== 2 ) {
530
- throw new \Exception ('Invalid input(s) ' );
531
- }
532
- break ;
533
- }
534
- case 'OCA \\ContextChat \\TextProcessing \\ContextChatTaskType ' :
535
- {
536
- if ((count ($ inputs ) !== 1 && count ($ inputs ) !== 4 )
537
- || !isset ($ inputs ['prompt ' ])
538
- || !is_string ($ inputs ['prompt ' ])
539
- ) {
540
- throw new \Exception ('Invalid input(s) ' );
541
- }
542
-
543
- if (count ($ inputs ) === 4 ) {
544
- if (!isset ($ inputs ['scopeType ' ]) || !is_string ($ inputs ['scopeType ' ])
545
- || !isset ($ inputs ['scopeList ' ]) || !is_array ($ inputs ['scopeList ' ])
546
- || !isset ($ inputs ['scopeListMeta ' ]) || !is_array ($ inputs ['scopeListMeta ' ])) {
547
- throw new \Exception ('Invalid input(s) ' );
548
- }
549
- }
550
-
551
- break ;
552
- }
553
- default :
554
- {
555
- if (!is_string ($ inputs ['prompt ' ]) || count ($ inputs ) !== 1 ) {
556
- throw new \Exception ('Invalid input(s) ' );
557
- }
558
- break ;
559
- }
560
- }
561
- return $ inputs ;
562
- }
563
-
564
512
/**
565
513
* Parse text from file (if parsing the file type is supported)
566
514
* @param string $userId
0 commit comments