Verfügbarkeitstest für API Provider ergänzt.
This commit is contained in:
29
database/factories/AiModelFactory.php
Normal file
29
database/factories/AiModelFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\AiModel;
|
||||
use App\Models\ApiProvider;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AiModelFactory extends Factory
|
||||
{
|
||||
protected $model = AiModel::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->word() . ' Model',
|
||||
'model_id' => $this->faker->uuid(),
|
||||
'model_type' => $this->faker->randomElement(['text-to-image', 'image-to-image', 'inpainting']),
|
||||
'parameters' => json_encode([
|
||||
'steps' => 30,
|
||||
'cfg_scale' => 7.5,
|
||||
'sampler' => 'Euler a',
|
||||
'width' => 512,
|
||||
'height' => 512
|
||||
]),
|
||||
'api_provider_id' => ApiProvider::factory(),
|
||||
];
|
||||
}
|
||||
}
|
||||
24
database/factories/ApiProviderFactory.php
Normal file
24
database/factories/ApiProviderFactory.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\ApiProvider;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ApiProviderFactory extends Factory
|
||||
{
|
||||
protected $model = ApiProvider::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->company(),
|
||||
'api_url' => $this->faker->url(),
|
||||
'username' => $this->faker->userName(),
|
||||
'password' => $this->faker->password(),
|
||||
'token' => $this->faker->sha256(),
|
||||
'plugin' => $this->faker->randomElement(['comfyui', 'runwareai']),
|
||||
'enabled' => $this->faker->boolean(),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
database/factories/StyleFactory.php
Normal file
30
database/factories/StyleFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Style;
|
||||
use App\Models\AiModel;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class StyleFactory extends Factory
|
||||
{
|
||||
protected $model = Style::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'title' => $this->faker->words(3, true),
|
||||
'prompt' => $this->faker->sentence(),
|
||||
'description' => $this->faker->paragraph(),
|
||||
'preview_image' => 'styles/preview.jpg',
|
||||
'parameters' => json_encode([
|
||||
'positive' => $this->faker->sentence(),
|
||||
'negative' => $this->faker->sentence(),
|
||||
'steps' => 30,
|
||||
'cfg_scale' => 7.5
|
||||
]),
|
||||
'ai_model_id' => AiModel::factory(),
|
||||
'enabled' => $this->faker->boolean(80),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user