feat: ai prompt change
This commit is contained in:
@@ -19,6 +19,33 @@ it('generates an ai meal post with an image', function () {
|
||||
config()->set('meal_posts.ai_generation.image_path', 'meal-posts/ai-generated');
|
||||
config()->set('meal_posts.ai_generation.image_quality', 'medium');
|
||||
|
||||
foreach (range(1, 11) as $index) {
|
||||
$mealPost = MealPosts::factory()->create([
|
||||
'eaten_at' => now()->subMinutes(11 - $index),
|
||||
]);
|
||||
|
||||
$mealPost->ingredients()->createMany([
|
||||
[
|
||||
'position' => 1,
|
||||
'ingredient' => $index === 1 ? 'Topinambour ancien' : "Ingredient recent {$index}",
|
||||
'quantity' => 120,
|
||||
'unit' => IngredientUnit::GRAM->value,
|
||||
],
|
||||
[
|
||||
'position' => 2,
|
||||
'ingredient' => $index === 11 ? 'Asperges' : "Accompagnement recent {$index}",
|
||||
'quantity' => 80,
|
||||
'unit' => IngredientUnit::GRAM->value,
|
||||
],
|
||||
[
|
||||
'position' => 4,
|
||||
'ingredient' => "Garniture ignoree {$index}",
|
||||
'quantity' => 10,
|
||||
'unit' => IngredientUnit::GRAM->value,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
MealMaker::fake([
|
||||
[
|
||||
'title' => 'Bowl de saumon croustillant',
|
||||
@@ -53,7 +80,10 @@ it('generates an ai meal post with an image', function () {
|
||||
$this->artisan('meal-posts:generate-ai')
|
||||
->assertExitCode(0);
|
||||
|
||||
$mealPost = MealPosts::query()->with('user', 'ingredients')->firstOrFail();
|
||||
$mealPost = MealPosts::query()
|
||||
->where('ai_generated', true)
|
||||
->with('user', 'ingredients')
|
||||
->firstOrFail();
|
||||
|
||||
expect($mealPost->ai_generated)->toBeTrue()
|
||||
->and($mealPost->title)->toBe('Bowl de saumon croustillant')
|
||||
@@ -75,7 +105,13 @@ it('generates an ai meal post with an image', function () {
|
||||
]);
|
||||
|
||||
MealMaker::assertPrompted(
|
||||
fn ($prompt): bool => str_contains($prompt->prompt, 'Genere un plat aleatoire')
|
||||
fn ($prompt): bool => str_contains($prompt->prompt, 'Genere un plat completement aleatoire')
|
||||
&& str_contains($prompt->prompt, 'sans tenir compte du mois actuel')
|
||||
&& str_contains($prompt->prompt, 'Evite les ingredients principaux deja utilises dans les 10 derniers repas')
|
||||
&& str_contains($prompt->prompt, 'Ingredient recent 2')
|
||||
&& str_contains($prompt->prompt, 'Asperges')
|
||||
&& ! str_contains($prompt->prompt, 'Topinambour ancien')
|
||||
&& ! str_contains($prompt->prompt, 'Garniture ignoree 11')
|
||||
);
|
||||
|
||||
Image::assertGenerated(
|
||||
|
||||
Reference in New Issue
Block a user