- Created `quick-replies.blade.php` for managing quick replies. - Added `settings.blade.php` for admin settings management. - Implemented `ticket-show.blade.php` to display ticket details. - Introduced `timeline-card.blade.php` component for displaying timeline information. Enhance quick reply management functionality - Developed `quick-reply-manager.blade.php` for creating and editing quick replies. - Integrated Livewire for dynamic interaction and validation. Implement settings page for AI configuration - Created `settings-page.blade.php` for managing AI settings, including prompts and provider instances. - Added functionality for managing models and embeddings. Add ticket show functionality with real-time updates - Implemented ticket details view with processing status and tool call logs. - Added support for displaying article suggestions and error messages. Create unit tests for AI classifier and domain info tool - Added `AIClassifierServiceTest.php` to validate AI classifier functionality. - Implemented `DomainInfoToolTest.php` for domain parameter validation. - Created `OxxaClientTest.php` to test API interactions and password hashing.
77 lines
1.8 KiB
PHP
77 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Casts\VectorCast;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Ticket extends Model
|
|
{
|
|
protected $fillable = [
|
|
'message',
|
|
'normalized_message',
|
|
'redaction_report',
|
|
'embedding',
|
|
'embedding_provider_instance_id',
|
|
'embedding_model',
|
|
'embedded_at',
|
|
'status',
|
|
'best_article_id',
|
|
'confidence',
|
|
'explanation',
|
|
'support_reply',
|
|
'needs_article_draft',
|
|
'draft_article_id',
|
|
'result_payload',
|
|
'api_credentials',
|
|
'error_message',
|
|
'processed_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'embedding' => VectorCast::class,
|
|
'redaction_report' => 'array',
|
|
'result_payload' => 'array',
|
|
'api_credentials' => 'encrypted:array',
|
|
'needs_article_draft' => 'boolean',
|
|
'embedded_at' => 'datetime',
|
|
'processed_at' => 'datetime',
|
|
];
|
|
|
|
public function decisions(): HasMany
|
|
{
|
|
return $this->hasMany(AIDecision::class);
|
|
}
|
|
|
|
public function feedback(): HasMany
|
|
{
|
|
return $this->hasMany(Feedback::class);
|
|
}
|
|
|
|
public function logs(): HasMany
|
|
{
|
|
return $this->hasMany(TicketProcessingLog::class)
|
|
->orderByDesc('created_at')
|
|
->orderByDesc('id');
|
|
}
|
|
|
|
public function toolCalls(): HasMany
|
|
{
|
|
return $this->hasMany(TicketToolCall::class)
|
|
->orderByDesc('created_at')
|
|
->orderByDesc('id');
|
|
}
|
|
|
|
public function bestArticle(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Article::class, 'best_article_id');
|
|
}
|
|
|
|
public function draftArticle(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Article::class, 'draft_article_id');
|
|
}
|
|
}
|