frontend richtig schick gemacht und backend geordnet. ComfyUI Prompt zum Seeder hinzugefügt.
This commit is contained in:
@@ -2,29 +2,24 @@
|
||||
|
||||
namespace App\Filament\Resources\AiModels;
|
||||
|
||||
use BackedEnum;
|
||||
use App\Filament\Resources\AiModels\Pages;
|
||||
use App\Filament\Resources\AiModels\RelationManagers;
|
||||
use App\Models\AiModel;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\ApiProvider;
|
||||
use App\Api\Plugins\PluginLoader;
|
||||
use App\Api\Plugins\ApiPluginInterface;
|
||||
use App\Api\Plugins\PluginLoader;
|
||||
use App\Models\AiModel;
|
||||
use App\Models\ApiProvider;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AiModelResource extends Resource
|
||||
{
|
||||
@@ -32,6 +27,13 @@ class AiModelResource extends Resource
|
||||
|
||||
// protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?int $navigationSort = -100;
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('filament.navigation.groups.ai_models');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
@@ -49,16 +51,16 @@ class AiModelResource extends Resource
|
||||
->rows(15),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
protected static function canSearchModelsWithAnyProvider(?array $apiProviderIds): bool
|
||||
{
|
||||
if (empty($apiProviderIds)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
foreach ($apiProviderIds as $apiProviderId) {
|
||||
$apiProvider = ApiProvider::find($apiProviderId);
|
||||
if (!$apiProvider || !$apiProvider->plugin) {
|
||||
if (! $apiProvider || ! $apiProvider->plugin) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
@@ -71,16 +73,17 @@ class AiModelResource extends Resource
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static function getPluginInstance(?int $apiProviderId): ?ApiPluginInterface
|
||||
{
|
||||
if (!$apiProviderId) {
|
||||
if (! $apiProviderId) {
|
||||
return null;
|
||||
}
|
||||
$apiProvider = ApiProvider::find($apiProviderId);
|
||||
if (!$apiProvider || !$apiProvider->plugin) {
|
||||
if (! $apiProvider || ! $apiProvider->plugin) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
@@ -93,15 +96,16 @@ class AiModelResource extends Resource
|
||||
|
||||
protected static function canSearchModels(?int $apiProviderId): bool
|
||||
{
|
||||
if (!$apiProviderId) {
|
||||
if (! $apiProviderId) {
|
||||
return false;
|
||||
}
|
||||
$apiProvider = ApiProvider::find($apiProviderId);
|
||||
if (!$apiProvider || !$apiProvider->plugin) {
|
||||
if (! $apiProvider || ! $apiProvider->plugin) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
$pluginInstance = PluginLoader::getPlugin($apiProvider->plugin, $apiProvider);
|
||||
|
||||
return method_exists($pluginInstance, 'searchModels');
|
||||
} catch (\Exception $e) {
|
||||
// Log the exception if needed
|
||||
@@ -141,14 +145,14 @@ class AiModelResource extends Resource
|
||||
CreateAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
@@ -156,5 +160,5 @@ class AiModelResource extends Resource
|
||||
'create' => Pages\CreateAiModel::route('/create'),
|
||||
'edit' => Pages\EditAiModel::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user