Skip to content

Commit

Permalink
fixup! add thread summary ui
Browse files Browse the repository at this point in the history
Signed-off-by: hamza221 <[email protected]>
  • Loading branch information
hamza221 committed Aug 3, 2023
1 parent 4bc481e commit c5cbc5a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
12 changes: 6 additions & 6 deletions lib/Controller/ThreadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class ThreadController extends Controller {


public function __construct(string $appName,
IRequest $request,
string $UserId,
AccountService $accountService,
IMailManager $mailManager,
AiIntegrationsService $aiIntergrationsService,
LoggerInterface $logger,
IRequest $request,
string $UserId,
AccountService $accountService,
IMailManager $mailManager,
AiIntegrationsService $aiIntergrationsService,
LoggerInterface $logger,
) {
parent::__construct($appName, $request);

Expand Down
23 changes: 11 additions & 12 deletions lib/Service/AiIntegrationsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use OCP\TextProcessing\IManager;
use OCP\TextProcessing\SummaryTaskType;
use OCP\TextProcessing\Task;
use OCP\PreConditionNotMetException;
use Psr\Container\ContainerInterface;
use function array_map;

Expand All @@ -52,20 +51,20 @@ public function __construct(ContainerInterface $container) {
public function summarizeThread(string $threadId, array $messages, string $currentUserId): null|string {
try {
$manager = $this->container->get(IManager::class);

Check failure on line 53 in lib/Service/AiIntegrationsService.php

View workflow job for this annotation

GitHub Actions / Nextcloud dev-stable27

UndefinedClass

lib/Service/AiIntegrationsService.php:53:37: UndefinedClass: Class, interface or enum named OCP\TextProcessing\IManager does not exist (see https://psalm.dev/019)

Check failure on line 53 in lib/Service/AiIntegrationsService.php

View workflow job for this annotation

GitHub Actions / Nextcloud dev-stable26

UndefinedClass

lib/Service/AiIntegrationsService.php:53:37: UndefinedClass: Class, interface or enum named OCP\TextProcessing\IManager does not exist (see https://psalm.dev/019)
if(in_array(SummaryTaskType::class, $manager->getAvailableTaskTypes(), true)) {
if(in_array(SummaryTaskType::class, $manager->getAvailableTaskTypes(), true)) {

Check failure on line 54 in lib/Service/AiIntegrationsService.php

View workflow job for this annotation

GitHub Actions / Nextcloud dev-stable27

UndefinedClass

lib/Service/AiIntegrationsService.php:54:16: UndefinedClass: Class, interface or enum named OCP\TextProcessing\SummaryTaskType does not exist (see https://psalm.dev/019)

Check failure on line 54 in lib/Service/AiIntegrationsService.php

View workflow job for this annotation

GitHub Actions / Nextcloud dev-stable26

UndefinedClass

lib/Service/AiIntegrationsService.php:54:16: UndefinedClass: Class, interface or enum named OCP\TextProcessing\SummaryTaskType does not exist (see https://psalm.dev/019)

$messagesBodies = array_map(function ($message) {
return $message->getPreviewText();
}, $messages);
$messagesBodies = array_map(function ($message) {
return $message->getPreviewText();
}, $messages);

$taskPrompt = implode("\n", $messagesBodies);
$summaryTask = new Task(SummaryTaskType::class, $taskPrompt, "mail", $currentUserId, $threadId);
$manager->runTask($summaryTask);
$taskPrompt = implode("\n", $messagesBodies);
$summaryTask = new Task(SummaryTaskType::class, $taskPrompt, "mail", $currentUserId, $threadId);

Check failure on line 61 in lib/Service/AiIntegrationsService.php

View workflow job for this annotation

GitHub Actions / Nextcloud dev-stable27

UndefinedClass

lib/Service/AiIntegrationsService.php:61:24: UndefinedClass: Class, interface or enum named OCP\TextProcessing\Task does not exist (see https://psalm.dev/019)

Check failure on line 61 in lib/Service/AiIntegrationsService.php

View workflow job for this annotation

GitHub Actions / Nextcloud dev-stable27

UndefinedClass

lib/Service/AiIntegrationsService.php:61:29: UndefinedClass: Class, interface or enum named OCP\TextProcessing\SummaryTaskType does not exist (see https://psalm.dev/019)

Check failure on line 61 in lib/Service/AiIntegrationsService.php

View workflow job for this annotation

GitHub Actions / Nextcloud dev-stable26

UndefinedClass

lib/Service/AiIntegrationsService.php:61:24: UndefinedClass: Class, interface or enum named OCP\TextProcessing\Task does not exist (see https://psalm.dev/019)

Check failure on line 61 in lib/Service/AiIntegrationsService.php

View workflow job for this annotation

GitHub Actions / Nextcloud dev-stable26

UndefinedClass

lib/Service/AiIntegrationsService.php:61:29: UndefinedClass: Class, interface or enum named OCP\TextProcessing\SummaryTaskType does not exist (see https://psalm.dev/019)
$manager->runTask($summaryTask);

return $summaryTask->getOutput();
} else {
throw new ServiceException('No language model available for summary');
}
return $summaryTask->getOutput();
} else {
throw new ServiceException('No language model available for summary');
}
} catch (\Throwable $e) {
throw new ServiceException('Text processing is not available in your current Nextcloud version');
}
Expand Down

0 comments on commit c5cbc5a

Please sign in to comment.