style updates
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\AI\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
final class AIPrompt extends Model
|
||||
{
|
||||
protected $fillable=['name','slug','purpose','system_prompt','user_template','variables','version','is_active','created_by'];
|
||||
protected $casts=['variables'=>'array','is_active'=>'boolean'];
|
||||
protected $fillable = ['name', 'slug', 'purpose', 'system_prompt', 'user_template', 'variables', 'version', 'is_active', 'created_by'];
|
||||
|
||||
protected $casts = ['variables' => 'array', 'is_active' => 'boolean'];
|
||||
|
||||
public function render(array $variables): string
|
||||
{
|
||||
return preg_replace_callback('/\{\{\s*([\w.]+)\s*\}\}/', fn($m)=>(string)data_get($variables,$m[1],''), $this->user_template) ?? $this->user_template;
|
||||
return preg_replace_callback('/\{\{\s*([\w.]+)\s*\}\}/', fn ($m) => (string) data_get($variables, $m[1], ''), $this->user_template) ?? $this->user_template;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user