Skip to content

Commit ba1d13f

Browse files
splitbraingithub-actions[bot]
authored andcommitted
🤖 Automatic code style fixes
1 parent 36c4749 commit ba1d13f

File tree

10 files changed

+10
-25
lines changed

10 files changed

+10
-25
lines changed

‎Embeddings.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ class Embeddings
5050
/**
5151
* Embeddings constructor.
5252
*
53-
* @param ChatInterface $chatModel
54-
* @param EmbeddingInterface $embedModel
55-
* @param AbstractStorage $storage
5653
* @param array $config The plugin configuration
5754
*/
5855
public function __construct(

‎Model/AbstractModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ abstract class AbstractModel implements ModelInterface
3838
protected $requestStart = 0;
3939

4040
/** @var int How often to retry a request if it fails */
41-
public const MAX_RETRIES = 3;
41+
final public const MAX_RETRIES = 3;
4242

4343
/** @var DokuHTTPClient */
4444
protected $http;
@@ -194,7 +194,7 @@ public function setDebug($debug = true)
194194
* @return mixed
195195
* @throws \Exception when the response indicates an error
196196
*/
197-
abstract protected function parseAPIResponse($response);
197+
abstract protected function parseAPIResponse(mixed $response);
198198

199199
/**
200200
* Send a request to the API

‎Model/Groq/ChatModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct(string $name, array $config)
1616
throw new \Exception('Groq API key not configured');
1717
}
1818

19-
$this->http->headers['Authorization'] = 'Bearer '.$config['groq_apikey'];
19+
$this->http->headers['Authorization'] = 'Bearer ' . $config['groq_apikey'];
2020
}
2121

2222
/** @inheritdoc */

‎Model/Ollama/AbstractOllama.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,4 @@ protected function parseAPIResponse($response)
5151

5252
return $response;
5353
}
54-
5554
}

‎Model/Reka/ChatModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ protected function request($endpoint, $data)
6565
/** @inheritdoc */
6666
protected function parseAPIResponse($response)
6767
{
68-
if(((int) $this->http->status) !== 200) {
69-
if(isset($response['detail'])) {
68+
if (((int) $this->http->status) !== 200) {
69+
if (isset($response['detail'])) {
7070
throw new \Exception('Reka API error: ' . $response['detail']);
7171
} else {
7272
throw new \Exception('Reka API error: ' . $this->http->status . ' ' . $this->http->error);

‎ModelFactory.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
class ModelFactory
99
{
10-
/** @var array The plugin configuration */
11-
protected array $config;
12-
1310
public $chatModel;
1411
public $rephraseModel;
1512
public $embeddingModel;
@@ -19,9 +16,8 @@ class ModelFactory
1916
/**
2017
* @param array $config The plugin configuration
2118
*/
22-
public function __construct(array $config)
19+
public function __construct(protected array $config)
2320
{
24-
$this->config = $config;
2521
}
2622

2723
/**
@@ -39,8 +35,6 @@ public function updateConfig(array $config)
3935

4036
/**
4137
* Set the debug flag for all models
42-
*
43-
* @param bool $debug
4438
*/
4539
public function setDebug(bool $debug = true)
4640
{
@@ -122,7 +116,7 @@ public function getModels($availableOnly = false, $typeOnly = '')
122116
try {
123117
$info['instance'] = $this->loadModel($type, "$namespace $name");
124118
$info['instance']->setDebug($this->debug);
125-
} catch (\Exception $e) {
119+
} catch (\Exception) {
126120
if ($availableOnly) continue;
127121
$info['instance'] = false;
128122
}

‎Storage/PineconeStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function deletePageChunks($page, $firstChunkID)
124124
$this->runQuery('/vectors/delete', ['ids' => $ids]);
125125
} catch (\Exception $e) {
126126
// 5 is the code for "namespace not found" See #12
127-
if($e->getCode() !== 5) throw $e;
127+
if ($e->getCode() !== 5) throw $e;
128128
}
129129
}
130130

‎cli.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,10 @@ protected function createEmbeddings($clear)
358358
$data = $this->helper->getRunData();
359359
$lastEmbedModel = $data['embed used'] ?? '';
360360

361-
if(
361+
if (
362362
!$clear && $lastEmbedModel &&
363363
$lastEmbedModel != (string) $this->helper->getEmbeddingModel()
364-
){
364+
) {
365365
$this->warning('Embedding model has changed since last run. Forcing an index rebuild');
366366
$clear = true;
367367
}

‎cli/simulate.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ protected function records2rows(array $result): array
159159
/**
160160
* Prefix each key in the given stats array to be merged with a larger array
161161
*
162-
* @param string $prefix
163-
* @param array $stats
164162
* @return array
165163
*/
166164
protected function flattenStats(string $prefix, array $stats)
@@ -173,7 +171,6 @@ protected function flattenStats(string $prefix, array $stats)
173171
}
174172

175173
/**
176-
* @param string $file
177174
* @return array
178175
* @throws Exception
179176
*/

‎helper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public function setLogger($logger)
5959
/**
6060
* Update the configuration
6161
*
62-
* @param array $config
6362
* @return void
6463
*/
6564
public function updateConfig(array $config)
@@ -387,7 +386,6 @@ public function getLanguageLimit()
387386
/**
388387
* Store info about the last run
389388
*
390-
* @param array $data
391389
* @return void
392390
*/
393391
public function setRunData(array $data)

0 commit comments

Comments
 (0)