Fix Afia AI assistant for Ladill Link.
Deploy Ladill Link / deploy (push) Successful in 31s

Wire the chat route and Link-scoped system prompt, include the Afia panel in the main layout, and point the UI at link.afia.chat instead of the copied QR Plus route.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-27 14:31:00 +00:00
co-authored by Cursor
parent f1fe749934
commit 5a3631cd2e
8 changed files with 127 additions and 37 deletions
+4 -4
View File
@@ -39,16 +39,16 @@ class AfiaTest extends TestCase
{
config(['afia.api_key' => 'sk-test', 'afia.provider' => 'openai', 'afia.model' => 'gpt-4o-mini']);
Http::fake([
'api.openai.com/*' => Http::response(['choices' => [['message' => ['content' => 'Create a Business QR under My Codes.']]]]),
'api.openai.com/*' => Http::response(['choices' => [['message' => ['content' => 'Create a short link under My Links.']]]]),
]);
$this->actingAs($this->user())
->postJson('/afia/chat', ['message' => 'How do I create a business QR?'])
->postJson('/afia/chat', ['message' => 'How do I create a short link?'])
->assertOk()
->assertJson(['reply' => 'Create a Business QR under My Codes.']);
->assertJson(['reply' => 'Create a short link under My Links.']);
Http::assertSent(fn ($r) => str_contains($r->url(), 'openai.com')
&& collect($r['messages'])->first()['role'] === 'system'
&& str_contains(collect($r['messages'])->first()['content'], 'Ladill QR Plus'));
&& str_contains(collect($r['messages'])->first()['content'], 'Ladill Link'));
}
}