Skip to content

Commit

Permalink
fixup! feat: ai message summary
Browse files Browse the repository at this point in the history
Signed-off-by: SebastianKrupinski <[email protected]>
  • Loading branch information
SebastianKrupinski committed Dec 17, 2024
1 parent ab9040d commit e2f47a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
18 changes: 15 additions & 3 deletions lib/Listener/TaskProcessingListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,21 @@ public function handle(Event $event): void {
return;

Check warning on line 44 in lib/Listener/TaskProcessingListener.php

View check run for this annotation

Codecov / codecov/patch

lib/Listener/TaskProcessingListener.php#L43-L44

Added lines #L43 - L44 were not covered by tests
}

[$type, $id] = explode(':', $task->getCustomId());
$userId = $task->getUserId();
$summary = $task->getOutput()['output'];
if ($task->getCustomId() !== null) {
[$type, $id] = explode(':', $task->getCustomId());

Check warning on line 48 in lib/Listener/TaskProcessingListener.php

View check run for this annotation

Codecov / codecov/patch

lib/Listener/TaskProcessingListener.php#L47-L48

Added lines #L47 - L48 were not covered by tests
} else {
$this->logger->info('Error handling task processing event custom id missing');

Check warning on line 50 in lib/Listener/TaskProcessingListener.php

View check run for this annotation

Codecov / codecov/patch

lib/Listener/TaskProcessingListener.php#L50

Added line #L50 was not covered by tests
}
if ($task->getUserId() !== null) {
$userId = $task->getUserId();

Check warning on line 53 in lib/Listener/TaskProcessingListener.php

View check run for this annotation

Codecov / codecov/patch

lib/Listener/TaskProcessingListener.php#L52-L53

Added lines #L52 - L53 were not covered by tests
} else {
$this->logger->info('Error handling task processing event user id missing');

Check warning on line 55 in lib/Listener/TaskProcessingListener.php

View check run for this annotation

Codecov / codecov/patch

lib/Listener/TaskProcessingListener.php#L55

Added line #L55 was not covered by tests
}
if ($task->getOutput() !== null && isset($task->getOutput()['output'])) {
$summary = $task->getOutput()['output'];

Check warning on line 58 in lib/Listener/TaskProcessingListener.php

View check run for this annotation

Codecov / codecov/patch

lib/Listener/TaskProcessingListener.php#L57-L58

Added lines #L57 - L58 were not covered by tests
} else {
$this->logger->info('Error handling task processing event output missing');

Check warning on line 60 in lib/Listener/TaskProcessingListener.php

View check run for this annotation

Codecov / codecov/patch

lib/Listener/TaskProcessingListener.php#L60

Added line #L60 was not covered by tests
}

if ($type === 'message') {

Check failure on line 63 in lib/Listener/TaskProcessingListener.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

PossiblyUndefinedVariable

lib/Listener/TaskProcessingListener.php:63:7: PossiblyUndefinedVariable: Possibly undefined variable $type, first seen on line 48 (see https://psalm.dev/018)
$this->handleMessageSummary($userId, (int)$id, $summary);

Check failure on line 64 in lib/Listener/TaskProcessingListener.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

PossiblyUndefinedVariable

lib/Listener/TaskProcessingListener.php:64:32: PossiblyUndefinedVariable: Possibly undefined variable $userId, first seen on line 53 (see https://psalm.dev/018)

Check failure on line 64 in lib/Listener/TaskProcessingListener.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

PossiblyUndefinedVariable

lib/Listener/TaskProcessingListener.php:64:46: PossiblyUndefinedVariable: Possibly undefined variable $id, first seen on line 48 (see https://psalm.dev/018)

Check failure on line 64 in lib/Listener/TaskProcessingListener.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

PossiblyUndefinedVariable

lib/Listener/TaskProcessingListener.php:64:51: PossiblyUndefinedVariable: Possibly undefined variable $summary, first seen on line 58 (see https://psalm.dev/018)

Check warning on line 64 in lib/Listener/TaskProcessingListener.php

View check run for this annotation

Codecov / codecov/patch

lib/Listener/TaskProcessingListener.php#L63-L64

Added lines #L63 - L64 were not covered by tests
Expand Down
5 changes: 1 addition & 4 deletions lib/Service/AiIntegrations/AiIntegrationsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,8 @@ public function __construct(
*
* @param Account $account
* @param array<Message> $messages
* @param Horde_Imap_Client_Socket $client
*
* @return null|string
*
* @throws ServiceException
* @return void
*/
public function summarizeMessages(Account $account, array $messages): void {
try {
Expand Down

0 comments on commit e2f47a5

Please sign in to comment.