diff --git a/Embeddings.php b/Embeddings.php index 471dbc2..d33d34d 100644 --- a/Embeddings.php +++ b/Embeddings.php @@ -50,9 +50,6 @@ class Embeddings /** * Embeddings constructor. * - * @param ChatInterface $chatModel - * @param EmbeddingInterface $embedModel - * @param AbstractStorage $storage * @param array $config The plugin configuration */ public function __construct( diff --git a/Model/AbstractModel.php b/Model/AbstractModel.php index 1ed4752..87dbe6a 100644 --- a/Model/AbstractModel.php +++ b/Model/AbstractModel.php @@ -38,7 +38,7 @@ abstract class AbstractModel implements ModelInterface protected $requestStart = 0; /** @var int How often to retry a request if it fails */ - public const MAX_RETRIES = 3; + final public const MAX_RETRIES = 3; /** @var DokuHTTPClient */ protected $http; @@ -194,7 +194,7 @@ public function setDebug($debug = true) * @return mixed * @throws \Exception when the response indicates an error */ - abstract protected function parseAPIResponse($response); + abstract protected function parseAPIResponse(mixed $response); /** * Send a request to the API diff --git a/ModelFactory.php b/ModelFactory.php index 41d0dc5..3ce76c0 100644 --- a/ModelFactory.php +++ b/ModelFactory.php @@ -7,9 +7,6 @@ class ModelFactory { - /** @var array The plugin configuration */ - protected array $config; - public $chatModel; public $rephraseModel; public $embeddingModel; @@ -19,9 +16,8 @@ class ModelFactory /** * @param array $config The plugin configuration */ - public function __construct(array $config) + public function __construct(protected array $config) { - $this->config = $config; } /** @@ -39,8 +35,6 @@ public function updateConfig(array $config) /** * Set the debug flag for all models - * - * @param bool $debug */ public function setDebug(bool $debug = true) { @@ -122,7 +116,7 @@ public function getModels($availableOnly = false, $typeOnly = '') try { $info['instance'] = $this->loadModel($type, "$namespace $name"); $info['instance']->setDebug($this->debug); - } catch (\Exception $e) { + } catch (\Exception) { if ($availableOnly) continue; $info['instance'] = false; } diff --git a/Storage/PineconeStorage.php b/Storage/PineconeStorage.php index 32695fe..a3b35ce 100644 --- a/Storage/PineconeStorage.php +++ b/Storage/PineconeStorage.php @@ -124,7 +124,7 @@ public function deletePageChunks($page, $firstChunkID) $this->runQuery('/vectors/delete', ['ids' => $ids]); } catch (\Exception $e) { // 5 is the code for "namespace not found" See #12 - if($e->getCode() !== 5) throw $e; + if ($e->getCode() !== 5) throw $e; } } diff --git a/cli.php b/cli.php index a4838bd..a379b50 100644 --- a/cli.php +++ b/cli.php @@ -357,10 +357,10 @@ protected function createEmbeddings($clear) $data = $this->helper->getRunData(); $lastEmbedModel = $data['embed used'] ?? ''; - if( + if ( !$clear && $lastEmbedModel && $lastEmbedModel != (string) $this->helper->getEmbeddingModel() - ){ + ) { $this->warning('Embedding model has changed since last run. Forcing an index rebuild'); $clear = true; } diff --git a/cli/simulate.php b/cli/simulate.php index 3c670e0..4726640 100644 --- a/cli/simulate.php +++ b/cli/simulate.php @@ -159,8 +159,6 @@ protected function records2rows(array $result): array /** * Prefix each key in the given stats array to be merged with a larger array * - * @param string $prefix - * @param array $stats * @return array */ protected function flattenStats(string $prefix, array $stats) @@ -173,7 +171,6 @@ protected function flattenStats(string $prefix, array $stats) } /** - * @param string $file * @return array * @throws Exception */ diff --git a/helper.php b/helper.php index 19fbc1f..ec62a9b 100644 --- a/helper.php +++ b/helper.php @@ -59,7 +59,6 @@ public function setLogger($logger) /** * Update the configuration * - * @param array $config * @return void */ public function updateConfig(array $config) @@ -387,7 +386,6 @@ public function getLanguageLimit() /** * Store info about the last run * - * @param array $data * @return void */ public function setRunData(array $data)