Skip to content

Commit

Permalink
Ok I think the mail problem was that after the first 1 it was stuff o…
Browse files Browse the repository at this point in the history
…n the foreach loop
  • Loading branch information
alnutile committed Aug 12, 2024
1 parent 0465154 commit 282cc6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/Domains/EmailParser/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function handle(int $limit = 10): void
}
}

public function getEmails(string $slug , int $limit = 10): array
public function getEmails(string $slug, int $limit = 10): array
{
$mail = [];

Expand Down
10 changes: 3 additions & 7 deletions app/Domains/Sources/EmailSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ public function handle(Source $source): void
$mailsComingIn = Client::getEmails($source->slug);
$this->source = $this->checkForChat($source);

if(empty($mailsComingIn)) {
Log::info('No mails coming in Source ' . $source->id);
if (empty($mailsComingIn)) {
Log::info('No mails coming in Source '.$source->id);

return;
} else {
foreach ($mailsComingIn as $mailDto) {
Expand Down Expand Up @@ -114,10 +115,5 @@ public function handle(Source $source): void
}
}






}
}
13 changes: 4 additions & 9 deletions tests/Feature/EmailSourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function test_uses_orchestrate()
'from' => '[email protected]',
'subject' => 'This is it',
'header' => 'This is header',
'body' => "Test",
'body' => 'Test',
]);

Client::shouldReceive('getEmails')->once()->andReturn([
Expand Down Expand Up @@ -178,14 +178,13 @@ public function tests_creates_chat_and_message()
'from' => '[email protected]',
'subject' => 'This is it',
'header' => 'This is header',
'body' => "Test",
'body' => 'Test',
]);

Client::shouldReceive('getEmails')->once()->andReturn([
$dto,
]);


LlmDriverFacade::shouldReceive('driver->setToolType->chat')->once()->andReturn(
CompletionResponse::from([
'content' => 'foo bar',
Expand Down Expand Up @@ -236,14 +235,13 @@ public function test_repeat_tasks()
'from' => '[email protected]',
'subject' => 'This is it',
'header' => 'This is header',
'body' => "Test",
'body' => 'Test',
]);

Client::shouldReceive('getEmails')->once()->andReturn([
$dto,
]);


LlmDriverFacade::shouldReceive('driver->setToolType->chat')->never();

$body = <<<'BODY'
Expand All @@ -256,7 +254,6 @@ public function test_repeat_tasks()

BODY;


SourceTask::factory()->create([
'source_id' => $source->id,
'task_key' => md5($dto->getContent()),
Expand Down Expand Up @@ -286,15 +283,13 @@ public function test_no_action_required()
'from' => '[email protected]',
'subject' => 'This is it',
'header' => 'This is header',
'body' => "Test",
'body' => 'Test',
]);

Client::shouldReceive('getEmails')->once()->andReturn([
$dto,
]);



LlmDriverFacade::shouldReceive('driver->setToolType->chat')->once()->andReturn(
CompletionResponse::from([
'content' => 'False',
Expand Down

0 comments on commit 282cc6a

Please sign in to comment.