Build Laravel 13 ticket assistant with Docker, Livewire admin, and helpdesk scraper command
This commit is contained in:
27
app/Models/AIDecision.php
Normal file
27
app/Models/AIDecision.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class AIDecision extends Model
|
||||
{
|
||||
protected $table = 'ai_decisions';
|
||||
|
||||
protected $fillable = ['ticket_id', 'article_id', 'confidence', 'explanation', 'raw_response'];
|
||||
|
||||
protected $casts = [
|
||||
'raw_response' => 'array',
|
||||
];
|
||||
|
||||
public function ticket(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Ticket::class);
|
||||
}
|
||||
|
||||
public function article(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Article::class);
|
||||
}
|
||||
}
|
||||
21
app/Models/Article.php
Normal file
21
app/Models/Article.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Casts\VectorCast;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Article extends Model
|
||||
{
|
||||
protected $fillable = ['title', 'content', 'embedding'];
|
||||
|
||||
protected $casts = [
|
||||
'embedding' => VectorCast::class,
|
||||
];
|
||||
|
||||
public function decisions(): HasMany
|
||||
{
|
||||
return $this->hasMany(AIDecision::class);
|
||||
}
|
||||
}
|
||||
16
app/Models/EmbeddingCache.php
Normal file
16
app/Models/EmbeddingCache.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EmbeddingCache extends Model
|
||||
{
|
||||
protected $table = 'embedding_cache';
|
||||
|
||||
protected $fillable = ['text_hash', 'text', 'embedding'];
|
||||
|
||||
protected $casts = [
|
||||
'embedding' => 'array',
|
||||
];
|
||||
}
|
||||
12
app/Models/Feedback.php
Normal file
12
app/Models/Feedback.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Feedback extends Model
|
||||
{
|
||||
protected $table = 'feedback';
|
||||
|
||||
protected $fillable = ['ticket_id', 'article_id', 'is_correct', 'notes'];
|
||||
}
|
||||
26
app/Models/Ticket.php
Normal file
26
app/Models/Ticket.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Casts\VectorCast;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Ticket extends Model
|
||||
{
|
||||
protected $fillable = ['message', 'embedding'];
|
||||
|
||||
protected $casts = [
|
||||
'embedding' => VectorCast::class,
|
||||
];
|
||||
|
||||
public function decisions(): HasMany
|
||||
{
|
||||
return $this->hasMany(AIDecision::class);
|
||||
}
|
||||
|
||||
public function feedback(): HasMany
|
||||
{
|
||||
return $this->hasMany(Feedback::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user