Skip to content

Commit

Permalink
move Webpage source to the new pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jul 22, 2024
1 parent e7596c3 commit 23726d6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
11 changes: 4 additions & 7 deletions app/Jobs/GetWebContentJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Log;
use Laravel\Pennant\Feature;
use LlmLaraHub\LlmDriver\LlmDriverFacade;
use LlmLaraHub\LlmDriver\ToolsHelper;
use LlmLaraHub\TagFunction\Jobs\TagDocumentJob;

class GetWebContentJob implements ShouldQueue
{
use Batchable, Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

use ChatHelperTrait, ToolsHelper;

/**
Expand Down Expand Up @@ -96,10 +94,10 @@ public function handle(): void
$promptResults = $results->content;
$chat = $this->source->chat;
$chat->addInput(
message: $prompt,
role: RoleEnum::User,
show_in_thread: true,
meta_data: MetaDataDto::from([
message: $prompt,
role: RoleEnum::User,
show_in_thread: true,
meta_data: MetaDataDto::from([
'driver' => $this->source->getDriver(),
'source' => $this->source->title,
]),
Expand Down Expand Up @@ -170,7 +168,6 @@ public function handle(): void
->onQueue(LlmDriverFacade::driver($this->source->getDriver())->onQueue())
->dispatch();


$assistantMessage = $chat->addInput(
message: $promptResults,
role: RoleEnum::Assistant,
Expand Down
6 changes: 1 addition & 5 deletions app/Jobs/WebPageSourceJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

namespace App\Jobs;

use App\Domains\Documents\StatusEnum;
use App\Domains\Documents\TypesEnum;
use App\Domains\Sources\WebSearch\Response\WebResponseDto;
use App\Models\Document;
use App\Models\Source;
use Facades\App\Domains\Sources\WebSearch\GetPage;
use Illuminate\Bus\Batch;
use Illuminate\Bus\Batchable;
use Illuminate\Bus\Queueable;
Expand Down Expand Up @@ -51,7 +47,7 @@ public function handle(): void
'url' => $this->url,
'title' => $title,
'age' => now()->toString(),
'description' => sprintf("From Source %s" ,$this->source->title),
'description' => sprintf('From Source %s', $this->source->title),
'meta_data' => [],
'thumbnail' => null,
'profile' => [],
Expand Down
1 change: 0 additions & 1 deletion tests/Feature/Jobs/GetWebContentJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ public function test_job_html(): void
$this->assertEquals('Example', $document->subject);

}

}
1 change: 0 additions & 1 deletion tests/Feature/WebPageSourceJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Domains\Sources\SourceTypeEnum;
use App\Jobs\WebPageSourceJob;
use App\Models\Source;
use Facades\App\Domains\Sources\WebSearch\GetPage;
use Illuminate\Support\Facades\Bus;
use LlmLaraHub\LlmDriver\LlmDriverFacade;
use Tests\TestCase;
Expand Down

0 comments on commit 23726d6

Please sign in to comment.