- Added tone instruction retrieval to SupportReplyService. - Improved user feedback when no relevant article is found. - Included article URL and tone instruction in LLM prompt. - Updated response format to include source information. - Enhanced article management UI with search functionality and editing capabilities. - Introduced a new API endpoint for nearest articles based on vector search. - Added confidence badge component to display article confidence levels. - Implemented tests for article searching, editing, and nearest article API. - Removed obsolete .htaccess file.
63 lines
2.0 KiB
PHP
63 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Article;
|
|
use App\Models\Ticket;
|
|
use App\Models\TicketToolCall;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class TicketShowPageTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_ticket_show_renders_quick_reply_and_tool_call_sections(): void
|
|
{
|
|
$article = Article::query()->create(['title' => 'DNS', 'content' => 'x']);
|
|
$ticket = Ticket::query()->create([
|
|
'message' => 'vraag',
|
|
'status' => 'completed',
|
|
'best_article_id' => $article->id,
|
|
'confidence' => 0.9,
|
|
'support_reply' => 'Gebruik deze stappen',
|
|
'result_payload' => [
|
|
'quick_reply' => ['id' => 1, 'title' => 'DNS Quick'],
|
|
'draft_article_suggestion' => null,
|
|
],
|
|
]);
|
|
|
|
TicketToolCall::query()->create([
|
|
'ticket_id' => $ticket->id,
|
|
'article_id' => $article->id,
|
|
'action' => 'domain_inf',
|
|
'status' => 'success',
|
|
'parameters' => ['sld' => 'example', 'tld' => 'nl'],
|
|
'response' => ['ok' => true],
|
|
]);
|
|
|
|
$response = $this->get("/admin/tickets/{$ticket->id}");
|
|
$response->assertOk();
|
|
$response->assertSee('Snelantwoord gebruikt', false);
|
|
$response->assertSee('Toolcalls', false);
|
|
$response->assertSee('haalt drempel', false);
|
|
}
|
|
|
|
public function test_ticket_show_marks_confidence_below_threshold(): void
|
|
{
|
|
$article = Article::query()->create(['title' => 'DNS', 'content' => 'x']);
|
|
$ticket = Ticket::query()->create([
|
|
'message' => 'vraag',
|
|
'status' => 'completed',
|
|
'best_article_id' => $article->id,
|
|
'confidence' => 0.25,
|
|
]);
|
|
|
|
$response = $this->get("/admin/tickets/{$ticket->id}");
|
|
|
|
$response->assertOk();
|
|
$response->assertSee('Confidence 0.25', false);
|
|
$response->assertSee('onder drempel 0.45', false);
|
|
}
|
|
}
|