Skip to content
Snippets Groups Projects

By yanniboi: Ability to log chat responses with event dispatcher.

Open Yan Loetzer requested to merge chat-logging into 1.0.x
2 files
+ 62
0
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 41
0
<?php
namespace Drupal\search_api_ai\Event;
use Drupal\Component\EventDispatcher\Event;
/**
* Event that is fired when chat gpt response comes in.
*/
class ChatResponseEvent extends Event {
const EVENT_NAME = 'search_api_ai_chat_response';
/**
* The prompt that was sent.
*
* @var string
*/
public $prompt;
/**
* The chat response.
*
* @var string
*/
public $question;
/**
* Constructs the object.
*
* @param string $prompt
* The prompt that was sent.
* @param string $response
* The chat response.
*/
public function __construct(string $prompt, string $response) {
$this->prompt = $prompt;
$this->response = $response;
}
}
Loading