DEBUG_CHATBOT

This commit is contained in:
Srinivas-Saravanan 2025-04-04 14:25:21 +05:30
parent 0918316715
commit 27817789ad
5 changed files with 23 additions and 7 deletions

View File

@ -17,6 +17,8 @@ class EcardDownloadConversation extends Conversation
protected function showEcardMenu() protected function showEcardMenu()
{ {
log_message('error', ('showEcardMenu function called'));
$chat_session_info = get_chatbot_session_info(); $chat_session_info = get_chatbot_session_info();
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info); $policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
$buttons = []; $buttons = [];

View File

@ -46,9 +46,14 @@ class MainMenuConversation extends Conversation
$this->bot->reply($message); $this->bot->reply($message);
} }
log_message('error', ('user_reponse before: ' . $user_reponse));
if (!$answer->isInteractiveMessageReply()) { if (!$answer->isInteractiveMessageReply()) {
$user_reponse = null; $user_reponse = null;
} }
// Get just the existing path array // Get just the existing path array
$path = $this->bot->userStorage()->get('path') ?? []; $path = $this->bot->userStorage()->get('path') ?? [];
@ -60,6 +65,9 @@ class MainMenuConversation extends Conversation
'path' => $path 'path' => $path
]); ]);
log_message('error', ('user_reponse : ' . $user_reponse));
switch ($user_reponse) { switch ($user_reponse) {
case "ecard_download": case "ecard_download":

View File

@ -59,7 +59,10 @@ class NetworkHospitalConversation extends Conversation
$this->bot->userStorage()->save([ $this->bot->userStorage()->save([
'path' => $path 'path' => $path
]); ]);
log_message('error', ('user_reponse : ' . $answer->getValue()));
switch ($answer->getValue()) { switch ($answer->getValue()) {
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2: case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
$client_poilicy_id = explode('#',$answer->getValue())[1]; $client_poilicy_id = explode('#',$answer->getValue())[1];

View File

@ -46,6 +46,9 @@ class policyConversation extends Conversation
if (!$answer->isInteractiveMessageReply()) { if (!$answer->isInteractiveMessageReply()) {
$user_reponse = null; $user_reponse = null;
} }
log_message('error', ('user_reponse : ' . $answer->getValue()));
$path = $this->bot->userStorage()->get('path'); $path = $this->bot->userStorage()->get('path');
array_push($path, array_push($path,
$answer->getValue() $answer->getValue()

View File

@ -89,7 +89,7 @@ class ChatbotControllerNew extends BaseController
$user = $this->botman->getUser(); $user = $this->botman->getUser();
$id = $user->getId(); $id = $user->getId();
// $this->myLogger->logme('error', ('TEST' . $id)); $this->myLogger->logme('error', ('TEST' . $id));
$this->session->set('CHATBOT_RANDOM_USER_ID', $id); $this->session->set('CHATBOT_RANDOM_USER_ID', $id);
} }
@ -128,14 +128,14 @@ class ChatbotControllerNew extends BaseController
$this->botman->listen(); $this->botman->listen();
} }
private function registerHandlers() // private function registerHandlers()
{ // {
// Handling Policy and Claims // // Handling Policy and Claims
$this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']); // $this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
$this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']); // $this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
} // }
public function chatbot() public function chatbot()
{ {