Skip to content

Commit

Permalink
add section prompt info
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jul 26, 2024
1 parent e6c082c commit fa0a945
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Modules/LlmDriver/app/Functions/GatherInfoToolMakeSections.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ protected function poolPrompt(array $prompts, Report $report, Document $document

foreach ($results as $resultIndex => $result) {
$content = $result->content;
$this->makeSectionFromContent($content, $document, $report);
$prompt = data_get($prompts, $resultIndex, 'no prompt found');
$this->makeSectionFromContent(
$content,
$document,
$report,
$prompt);
}

notify_ui($report->getChat(), 'Done gathering info');
Expand All @@ -45,7 +50,8 @@ protected function poolPrompt(array $prompts, Report $report, Document $document
protected function makeSectionFromContent(
string $content,
Document $document,
Report $report): void
Report $report,
string $prompt): void
{
try {

Expand All @@ -56,6 +62,7 @@ protected function makeSectionFromContent(
], [
'subject' => str($content)->limit(128)->toString(),
'content' => $content,
'prompt' => $prompt,
]);

} catch (\Exception $e) {
Expand Down
1 change: 1 addition & 0 deletions database/factories/SectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function definition(): array
'sort_order' => $this->faker->numberBetween(0, 100),
'document_id' => Document::factory(),
'report_id' => Report::factory(),
'prompt' => $this->faker->sentence(),
];
}
}
28 changes: 28 additions & 0 deletions database/migrations/2024_07_26_023241_add_prompt_to_sections.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('sections', function (Blueprint $table) {
$table->longText('prompt')->nullable();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('sections', function (Blueprint $table) {
//
});
}
};

0 comments on commit fa0a945

Please sign in to comment.