feat: implement AI styling foundation and billing scope rework
This commit is contained in:
56
app/Models/AiProviderRun.php
Normal file
56
app/Models/AiProviderRun.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class AiProviderRun extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public const STATUS_PENDING = 'pending';
|
||||
|
||||
public const STATUS_RUNNING = 'running';
|
||||
|
||||
public const STATUS_SUCCEEDED = 'succeeded';
|
||||
|
||||
public const STATUS_FAILED = 'failed';
|
||||
|
||||
protected $fillable = [
|
||||
'request_id',
|
||||
'provider',
|
||||
'attempt',
|
||||
'provider_task_id',
|
||||
'status',
|
||||
'http_status',
|
||||
'started_at',
|
||||
'finished_at',
|
||||
'duration_ms',
|
||||
'cost_usd',
|
||||
'tokens_input',
|
||||
'tokens_output',
|
||||
'request_payload',
|
||||
'response_payload',
|
||||
'error_message',
|
||||
'metadata',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'request_payload' => 'array',
|
||||
'response_payload' => 'array',
|
||||
'metadata' => 'array',
|
||||
'cost_usd' => 'decimal:5',
|
||||
'started_at' => 'datetime',
|
||||
'finished_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function request(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(AiEditRequest::class, 'request_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user