Skip to content

Commit d6e63e3

Browse files
committed
cleanup unused function, perhaps not even required
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
1 parent dff27ab commit d6e63e3

File tree

2 files changed

+4
-53
lines changed

2 files changed

+4
-53
lines changed

lib/Notification/Notifier.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ public function prepare(INotification $notification, string $languageCode): INot
9898
// Catch the custom copywriter task type built on top of the FreePrompt task type.
9999
$taskTypeName = $l->t('AI context writer');
100100
$taskInput = $l->t('Writing style: %1$s; Source material: %2$s', [$params['inputs']['writingStyle'], $params['inputs']['sourceMaterial']]);
101-
} elseif ($params['taskTypeId'] === 'context_chat:context_chat') {
101+
} elseif (
102+
$params['taskTypeId'] === 'context_chat:context_chat'
103+
|| $params['taskTypeId'] === 'legacy:TextProcessing:OCA\ContextChat\TextProcessing\ContextChatTaskType'
104+
) {
102105
$taskInput = $params['inputs']['prompt'] ?? null;
103106
$taskTypeName = $l->t('Context Chat');
104107
} else {

lib/Service/AssistantService.php

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -509,58 +509,6 @@ public function getOutputFilePreviewFile(string $userId, int $taskId, int $fileI
509509
return $this->previewService->getFilePreviewFile($taskOutputFile, $x, $y, $realMime ?: null);
510510
}
511511

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-
564512
/**
565513
* Parse text from file (if parsing the file type is supported)
566514
* @param string $userId

0 commit comments

Comments
 (0)