2024-07-23 15:22:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2024-07-23 16:40:56 +00:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2024-07-23 15:22:09 +00:00
|
|
|
|
|
|
|
class ChatHistory extends Model
|
|
|
|
{
|
2024-07-23 16:40:56 +00:00
|
|
|
protected $fillable = [
|
|
|
|
'chat_id',
|
|
|
|
'content',
|
2024-07-24 18:53:47 +00:00
|
|
|
'tool_calls',
|
2024-07-23 16:40:56 +00:00
|
|
|
'role',
|
|
|
|
'input_tokens',
|
|
|
|
'output_tokens',
|
|
|
|
'total_tokens',
|
|
|
|
];
|
|
|
|
|
2024-07-24 18:53:47 +00:00
|
|
|
protected $casts = [
|
|
|
|
'tool_calls' => 'array',
|
|
|
|
];
|
|
|
|
|
2024-07-23 16:40:56 +00:00
|
|
|
public function chat(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Chat::class);
|
|
|
|
}
|
2024-07-23 15:22:09 +00:00
|
|
|
}
|