Files

96 lines
5.0 KiB
PHP
Raw Permalink Normal View History

@extends('layouts.app')
@section('title', 'Runware Models — dreamstudio')
@section('content')
<div class="mb-8 rounded-md border border-gray-200 bg-white p-6">
<h2 class="mb-4 text-base font-semibold">Add a model</h2>
<p class="mb-4 text-sm text-gray-500">
Runware doesn't expose pricing through its API, so add models here with the price from
<a href="https://runware.ai/pricing" class="underline" target="_blank" rel="noopener">runware.ai/pricing</a>.
The cheapest active model per type is automatically used as the default.
</p>
<form method="POST" action="{{ route('runware-models.store') }}" class="grid grid-cols-2 gap-4 sm:grid-cols-3">
@csrf
<div>
<label class="block text-sm font-medium">Type</label>
<select name="modality" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
<option value="image">Image</option>
<option value="video">Video</option>
<option value="text">Text</option>
</select>
</div>
<div>
<label class="block text-sm font-medium">Model ID (AIR)</label>
<input type="text" name="air_id" required placeholder="e.g. bfl:flux@3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
</div>
<div>
<label class="block text-sm font-medium">Label</label>
<input type="text" name="label" required placeholder="e.g. Flux 3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
</div>
<div>
<label class="block text-sm font-medium">Billed per</label>
<select name="unit" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
<option value="per_image">Image</option>
<option value="per_second">Second (video)</option>
<option value="per_million_tokens">1M tokens (text)</option>
</select>
</div>
<div>
<label class="block text-sm font-medium">Price (USD)</label>
<input type="number" step="0.000001" min="0" name="price_usd" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
</div>
<div class="flex items-end">
<button type="submit" class="rounded-md bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-700">Add model</button>
</div>
</form>
</div>
<div class="rounded-md border border-gray-200 bg-white p-6">
<h2 class="mb-4 text-base font-semibold">Models</h2>
<table class="w-full text-left text-sm">
<thead>
<tr class="border-b border-gray-200 text-gray-500">
<th class="py-2">Type</th>
<th class="py-2">Label</th>
<th class="py-2">AIR ID</th>
<th class="py-2">Price</th>
<th class="py-2">Default</th>
<th class="py-2">Active</th>
<th class="py-2"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse ($models as $model)
<tr>
<td class="py-2 uppercase">{{ $model->modality }}</td>
<td class="py-2">{{ $model->label }}</td>
<td class="py-2 font-mono text-xs">{{ $model->air_id }}</td>
<td class="py-2">${{ $model->price_usd }} / {{ $model->unit }}</td>
<td class="py-2">{{ $model->is_default ? '✓' : '' }}</td>
<td class="py-2">
<form method="POST" action="{{ route('runware-models.update', $model) }}">
@csrf
@method('PATCH')
<input type="hidden" name="active" value="{{ $model->active ? 0 : 1 }}">
<button type="submit" class="underline">{{ $model->active ? 'Deactivate' : 'Activate' }}</button>
</form>
</td>
<td class="py-2">
<form method="POST" action="{{ route('runware-models.destroy', $model) }}" onsubmit="return confirm('Delete this model?')">
@csrf
@method('DELETE')
<button type="submit" class="text-red-700 underline">Delete</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="py-6 text-center text-gray-500">No models yet — add one above.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@endsection