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:
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user