diff --git a/src/Form/OchaAiConfigForm.php b/src/Form/OchaAiConfigForm.php index 44cec05..010d70a 100644 --- a/src/Form/OchaAiConfigForm.php +++ b/src/Form/OchaAiConfigForm.php @@ -3,6 +3,7 @@ namespace Drupal\ocha_ai\Form; use Drupal\Core\Config\ConfigFactoryInterface; +use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\ocha_ai\Plugin\AnswerValidatorPluginManagerInterface; @@ -88,6 +89,8 @@ class OchaAiConfigForm extends ConfigFormBase { * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory service. + * @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager + * The typed config manager service. * @param \Drupal\ocha_ai\Plugin\AnswerValidatorPluginManagerInterface $answer_validator_plugin_manager * The answer validator plugin manager. * @param \Drupal\ocha_ai\Plugin\CompletionPluginManagerInterface $completion_plugin_manager @@ -107,6 +110,7 @@ class OchaAiConfigForm extends ConfigFormBase { */ public function __construct( ConfigFactoryInterface $config_factory, + TypedConfigManagerInterface $typed_config_manager, AnswerValidatorPluginManagerInterface $answer_validator_plugin_manager, CompletionPluginManagerInterface $completion_plugin_manager, EmbeddingPluginManagerInterface $embedding_plugin_manager, @@ -116,7 +120,7 @@ public function __construct( TextSplitterPluginManagerInterface $text_splitter_plugin_manager, VectorStorePluginManagerInterface $vector_store_plugin_manager, ) { - parent::__construct($config_factory); + parent::__construct($config_factory, $typed_config_manager); $this->answerValidatorPluginManager = $answer_validator_plugin_manager; $this->completionPluginManager = $completion_plugin_manager; @@ -134,6 +138,7 @@ public function __construct( public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), + $container->get('config.typed'), $container->get('plugin.manager.ocha_ai.answer_validator'), $container->get('plugin.manager.ocha_ai.completion'), $container->get('plugin.manager.ocha_ai.embedding'), diff --git a/src/Plugin/ocha_ai/Ranker/OchaAiHelperRanker.php b/src/Plugin/ocha_ai/Ranker/OchaAiHelperRanker.php index fc0c0c0..1353b91 100644 --- a/src/Plugin/ocha_ai/Ranker/OchaAiHelperRanker.php +++ b/src/Plugin/ocha_ai/Ranker/OchaAiHelperRanker.php @@ -91,7 +91,7 @@ public function rankTexts(string $text, array $texts, string $language, ?int $li $endpoint = $this->getPluginSetting('endpoint'); try { - $response = $client = $this->httpClient->post($endpoint, [ + $response = $this->httpClient->post($endpoint, [ 'json' => [ 'language' => $language, 'text' => $text, diff --git a/src/Plugin/ocha_ai/TextSplitter/NLPSentence.php b/src/Plugin/ocha_ai/TextSplitter/NLPSentence.php index 2d4f331..7ee9bac 100644 --- a/src/Plugin/ocha_ai/TextSplitter/NLPSentence.php +++ b/src/Plugin/ocha_ai/TextSplitter/NLPSentence.php @@ -86,7 +86,7 @@ public function splitText(string $text, ?int $length = NULL, ?int $overlap = NUL $endpoint = $this->getPluginSetting('endpoint'); try { - $response = $client = $this->httpClient->post($endpoint, [ + $response = $this->httpClient->post($endpoint, [ 'json' => [ 'language' => $language, 'text' => $text,