diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index bd8a8cad..490cb424 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -14,7 +14,6 @@ use OCA\OpenAi\TaskProcessing\AudioToTextEnhancedProvider; use OCA\OpenAi\TaskProcessing\AudioToTextProvider; use OCA\OpenAi\TaskProcessing\ChangeToneProvider; -use OCA\OpenAi\TaskProcessing\ChangeToneTaskType; use OCA\OpenAi\TaskProcessing\ContextWriteProvider; use OCA\OpenAi\TaskProcessing\EmojiProvider; use OCA\OpenAi\TaskProcessing\HeadlineProvider; @@ -126,29 +125,16 @@ public function register(IRegistrationContext $context): void { $context->registerTaskProcessingProvider(ContextWriteProvider::class); $context->registerTaskProcessingProvider(ReformulateProvider::class); $context->registerTaskProcessingProvider(EmojiProvider::class); - if (!class_exists('OCP\\TaskProcessing\\TaskTypes\\TextToTextChangeTone')) { - $context->registerTaskProcessingTaskType(ChangeToneTaskType::class); - } $context->registerTaskProcessingProvider(ChangeToneProvider::class); - if (class_exists('OCP\\TaskProcessing\\TaskTypes\\TextToTextChatWithTools')) { - $context->registerTaskProcessingProvider(\OCA\OpenAi\TaskProcessing\TextToTextChatWithToolsProvider::class); - } - if (class_exists('OCP\\TaskProcessing\\TaskTypes\\TextToTextProofread')) { - $context->registerTaskProcessingProvider(\OCA\OpenAi\TaskProcessing\ProofreadProvider::class); - } + $context->registerTaskProcessingProvider(\OCA\OpenAi\TaskProcessing\TextToTextChatWithToolsProvider::class); + $context->registerTaskProcessingProvider(\OCA\OpenAi\TaskProcessing\ProofreadProvider::class); if (class_exists('OCP\\TaskProcessing\\TaskTypes\\TextToTextReformatParagraphs')) { $context->registerTaskProcessingProvider(\OCA\OpenAi\TaskProcessing\ReformatParagraphsProvider::class); } if ($isUsingOpenAI || $this->appConfig->getValueString(Application::APP_ID, 'analyze_image_provider_enabled') === '1') { - if (!class_exists('OCP\\TaskProcessing\\TaskTypes\\AnalyzeImages')) { - $context->registerTaskProcessingTaskType(\OCA\OpenAi\TaskProcessing\AnalyzeImagesTaskType::class); - } $context->registerTaskProcessingProvider(\OCA\OpenAi\TaskProcessing\AnalyzeImagesProvider::class); } } - if (!class_exists('OCP\\TaskProcessing\\TaskTypes\\TextToSpeech')) { - $context->registerTaskProcessingTaskType(\OCA\OpenAi\TaskProcessing\TextToSpeechTaskType::class); - } $context->registerTaskProcessingProvider(TextToSpeechProvider::class); if ($this->appConfig->getValueString(Application::APP_ID, 't2i_provider_enabled', '1') === '1') { $context->registerTaskProcessingProvider(TextToImageProvider::class); diff --git a/lib/TaskProcessing/AnalyzeImagesProvider.php b/lib/TaskProcessing/AnalyzeImagesProvider.php index b852f01b..1de90dc3 100644 --- a/lib/TaskProcessing/AnalyzeImagesProvider.php +++ b/lib/TaskProcessing/AnalyzeImagesProvider.php @@ -40,10 +40,7 @@ public function getName(): string { } public function getTaskTypeId(): string { - if (class_exists('OCP\\TaskProcessing\\TaskTypes\\AnalyzeImages')) { - return \OCP\TaskProcessing\TaskTypes\AnalyzeImages::ID; - } - return AnalyzeImagesTaskType::ID; + return \OCP\TaskProcessing\TaskTypes\AnalyzeImages::ID; } public function getExpectedRuntime(): int { diff --git a/lib/TaskProcessing/AnalyzeImagesTaskType.php b/lib/TaskProcessing/AnalyzeImagesTaskType.php deleted file mode 100644 index 13e12a53..00000000 --- a/lib/TaskProcessing/AnalyzeImagesTaskType.php +++ /dev/null @@ -1,77 +0,0 @@ -l->t('Analyze images'); - } - - /** - * @inheritDoc - */ - public function getDescription(): string { - return $this->l->t('Ask a question about the given images.'); - } - - /** - * @return string - */ - public function getId(): string { - return self::ID; - } - - /** - * @return ShapeDescriptor[] - */ - public function getInputShape(): array { - return [ - 'images' => new ShapeDescriptor( - $this->l->t('Images'), - $this->l->t('Images to ask a question about'), - EShapeType::ListOfImages, - ), - 'input' => new ShapeDescriptor( - $this->l->t('Question'), - $this->l->t('What to ask about the image.'), - EShapeType::Text, - ), - ]; - } - - /** - * @return ShapeDescriptor[] - */ - public function getOutputShape(): array { - return [ - 'output' => new ShapeDescriptor( - $this->l->t('Generated response'), - $this->l->t('The answer to the question'), - EShapeType::Text - ), - ]; - } -} diff --git a/lib/TaskProcessing/ChangeToneProvider.php b/lib/TaskProcessing/ChangeToneProvider.php index c3f883de..966e06f6 100644 --- a/lib/TaskProcessing/ChangeToneProvider.php +++ b/lib/TaskProcessing/ChangeToneProvider.php @@ -42,10 +42,7 @@ public function getName(): string { } public function getTaskTypeId(): string { - if (class_exists('OCP\\TaskProcessing\\TaskTypes\\TextToTextChangeTone')) { - return TextToTextChangeTone::ID; - } - return ChangeToneTaskType::ID; + return TextToTextChangeTone::ID; } public function getExpectedRuntime(): int { diff --git a/lib/TaskProcessing/ChangeToneTaskType.php b/lib/TaskProcessing/ChangeToneTaskType.php deleted file mode 100644 index 0a687bdd..00000000 --- a/lib/TaskProcessing/ChangeToneTaskType.php +++ /dev/null @@ -1,77 +0,0 @@ -l->t('Change Tone'); - } - - /** - * @inheritDoc - */ - public function getDescription(): string { - return $this->l->t('Ask a question about your data.'); - } - - /** - * @return string - */ - public function getId(): string { - return self::ID; - } - - /** - * @return ShapeDescriptor[] - */ - public function getInputShape(): array { - return [ - 'input' => new ShapeDescriptor( - $this->l->t('Input text'), - $this->l->t('Write a text that you want the assistant to rewrite in another tone.'), - EShapeType::Text, - ), - 'tone' => new ShapeDescriptor( - $this->l->t('Desired tone'), - $this->l->t('In which tone should your text be rewritten?'), - EShapeType::Enum, - ), - ]; - } - - /** - * @return ShapeDescriptor[] - */ - public function getOutputShape(): array { - return [ - 'output' => new ShapeDescriptor( - $this->l->t('Generated response'), - $this->l->t('The rewritten text in the desired tone, written by the assistant:'), - EShapeType::Text - ), - ]; - } -} diff --git a/lib/TaskProcessing/TextToSpeechProvider.php b/lib/TaskProcessing/TextToSpeechProvider.php index 16dd7416..dccba76c 100644 --- a/lib/TaskProcessing/TextToSpeechProvider.php +++ b/lib/TaskProcessing/TextToSpeechProvider.php @@ -42,10 +42,7 @@ public function getName(): string { } public function getTaskTypeId(): string { - if (class_exists('OCP\\TaskProcessing\\TaskTypes\\TextToSpeech')) { - return \OCP\TaskProcessing\TaskTypes\TextToSpeech::ID; - } - return TextToSpeechTaskType::ID; + return \OCP\TaskProcessing\TaskTypes\TextToSpeech::ID; } public function getExpectedRuntime(): int { diff --git a/lib/TaskProcessing/TextToSpeechTaskType.php b/lib/TaskProcessing/TextToSpeechTaskType.php deleted file mode 100644 index 74685124..00000000 --- a/lib/TaskProcessing/TextToSpeechTaskType.php +++ /dev/null @@ -1,72 +0,0 @@ -l->t('Generate speech'); - } - - /** - * @inheritDoc - */ - public function getDescription(): string { - return $this->l->t('Generate speech from a transcript'); - } - - /** - * @return string - */ - public function getId(): string { - return self::ID; - } - - /** - * @return ShapeDescriptor[] - */ - public function getInputShape(): array { - return [ - 'input' => new ShapeDescriptor( - $this->l->t('Prompt'), - $this->l->t('Write transcript that you want the assistant to generate speech from'), - EShapeType::Text, - ), - ]; - } - - /** - * @return ShapeDescriptor[] - */ - public function getOutputShape(): array { - return [ - 'speech' => new ShapeDescriptor( - $this->l->t('Output speech'), - $this->l->t('The generated speech'), - EShapeType::Audio - ), - ]; - } -}