Skip to content
Snippets Groups Projects
Commit 4f4715ed authored by Liam Morland's avatar Liam Morland Committed by Scott Euser
Browse files

Issue #3457892 by Liam Morland: Make coding standards fixes

parent e15120d0
No related branches found
No related tags found
1 merge request!94Issue #3457892: Make coding standards fixes
Pipeline #214868 passed with warnings
......@@ -5,5 +5,5 @@ package: OpenAI
core_version_requirement: ^10 || ^11
configure: openai_dblog.settings
dependencies:
- dblog
- drupal:dblog
- openai:openai
......@@ -139,22 +139,25 @@ class OpenAIDevelCommands extends DrushCommands {
* @option max_tokens The maximum number of tokens to generate in the response. The token count of your prompt plus max_tokens cannot exceed the model\'s context length.
* @option html If TRUE, OpenAI will be instructed to format the replies in basic HTML format for text formatted fields. Warning, this will consume many more tokens in the response.
*/
public function content($num = 15, array $options = [
'kill' => FALSE,
'bundles' => 'page,article',
'authors' => self::REQ,
'feedback' => 1,
'skip-fields' => self::REQ,
'base-fields' => self::REQ,
'languages' => self::REQ,
'translations' => self::REQ,
'add-type-label' => FALSE,
'model' => 'gpt-3.5-turbo',
'system' => self::REQ,
'temperature' => 0.4,
'max_tokens' => 512,
'html' => FALSE,
]) {
public function content(
$num = 15,
array $options = [
'kill' => FALSE,
'bundles' => 'page,article',
'authors' => self::REQ,
'feedback' => 1,
'skip-fields' => self::REQ,
'base-fields' => self::REQ,
'languages' => self::REQ,
'translations' => self::REQ,
'add-type-label' => FALSE,
'model' => 'gpt-3.5-turbo',
'system' => self::REQ,
'temperature' => 0.4,
'max_tokens' => 512,
'html' => FALSE,
],
) {
$this->generate();
}
......
......@@ -10,7 +10,6 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\openai\OpenAIApi;
/**
* Provides a ContentGPTDevelGenerate plugin.
......
......@@ -50,7 +50,8 @@ function openai_embeddings_entity_delete(EntityInterface $entity) {
],
]);
}
} catch (\Exception $e) {
}
catch (\Exception $e) {
\Drupal::logger('openai_embeddings')
->error('Error trying to delete record(s) in the vector database.');
}
......@@ -61,7 +62,8 @@ function openai_embeddings_entity_delete(EntityInterface $entity) {
->condition('entity_id', $entity->id())
->condition('entity_type', $entity->getEntityTypeId())
->execute();
} catch (\Exception $e) {
}
catch (\Exception $e) {
\Drupal::logger('openai_embeddings')
->error('Error trying to delete record(s) in the local database.');
}
......
......@@ -22,7 +22,7 @@ class VectorDatabaseStats extends ControllerBase {
*/
public function __construct(
protected VectorClientPluginManager $pluginManager,
protected ConfigFactoryInterface $config
protected ConfigFactoryInterface $config,
) {
}
......
......@@ -64,7 +64,7 @@ abstract class VectorClientPluginBase extends PluginBase implements VectorClient
protected ClientFactory $http_client_factory,
protected ConfigFactoryInterface $config_factory,
protected LoggerInterface $logger,
MessengerInterface $messenger
MessengerInterface $messenger,
) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->messenger = $messenger;
......
......@@ -25,7 +25,7 @@ final class OpenAIEventSubscriber implements EventSubscriberInterface {
public function __construct(
private readonly ConfigFactoryInterface $configFactory,
private readonly AdminContext $adminContext,
private readonly MessengerInterface $messenger
private readonly MessengerInterface $messenger,
) {}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment