-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscratch_test.php
More file actions
38 lines (29 loc) · 1.4 KB
/
Copy pathscratch_test.php
File metadata and controls
38 lines (29 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
require __DIR__ . '/vendor/autoload.php';
(new Dotenv())->bootEnv(__DIR__ . '/.env');
$kernel = new Kernel('dev', true);
$kernel->boot();
$container = $kernel->getContainer();
$entityManager = $container->get('doctrine.orm.entity_manager');
$tenantContext = new \App\Service\TenantContext($entityManager);
$owner = $entityManager->getRepository(App\Entity\Admin::class)->find(1);
if ($owner) {
$tenantContext->setCurrentOwner($owner);
$entityManager->clear();
$connection = $entityManager->getRepository(App\Entity\FacebookConnection::class)->findOneBy(['owner' => $owner]);
$aiSetting = $entityManager->getRepository(App\Entity\AiSetting::class)->findOneBy(['owner' => $owner, 'isActive' => true]);
if ($connection && $aiSetting) {
echo "Found Connection ID: " . $connection->getId() . "\n";
echo "Found AI Setting ID: " . $aiSetting->getId() . " (Provider: " . $aiSetting->getProvider() . ")\n";
$aiAgentService = $container->get(App\Service\AiAgentService::class);
echo "Calling generateResponse...\n";
$response = $aiAgentService->generateResponse("How much does it cost?", $aiSetting, $connection);
echo "Response: " . var_export($response, true) . "\n";
} else {
echo "Connection or AI Setting not found.\n";
}
} else {
echo "Owner ID = 1 not found\n";
}