Skip to content

Commit 8c08cb3

Browse files
committed
auto style fixes
1 parent 87090e4 commit 8c08cb3

File tree

6 files changed

+15
-18
lines changed

6 files changed

+15
-18
lines changed

AbstractCLI.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
namespace dokuwiki\plugin\aichat;
44

5+
use dokuwiki\Extension\CLIPlugin;
56
use splitbrain\phpcli\Options;
67

7-
abstract class AbstractCLI extends \dokuwiki\Extension\CLIPlugin
8+
abstract class AbstractCLI extends CLIPlugin
89
{
910
/** @var \helper_plugin_aichat */
1011
protected $helper;
@@ -44,11 +45,10 @@ protected function main(Options $options)
4445
$lc = $options->getOpt('lang');
4546
if ($lc === 'auto') {
4647
$this->helper->updateConfig(['preferUIlanguage' => 0]);
47-
} else if ($lc) {
48+
} elseif ($lc) {
4849
$this->helper->updateConfig(['preferUIlanguage' => 1]);
4950
global $conf;
5051
$conf['lang'] = $lc;
5152
}
52-
5353
}
5454
}

Embeddings.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ class Embeddings
5656
* @param array $config The plugin configuration
5757
*/
5858
public function __construct(
59-
ChatInterface $chatModel,
59+
ChatInterface $chatModel,
6060
EmbeddingInterface $embedModel,
61-
AbstractStorage $storage,
62-
$config
63-
)
64-
{
61+
AbstractStorage $storage,
62+
$config
63+
) {
6564
$this->chatModel = $chatModel;
6665
$this->embedModel = $embedModel;
6766
$this->storage = $storage;

Storage/SQLiteStorage.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
class SQLiteStorage extends AbstractStorage
1919
{
20-
2120
/** @var int Number of documents to randomly sample to create the clusters */
2221
final public const SAMPLE_SIZE = 2000;
2322
/** @var int The average size of each cluster */
@@ -40,7 +39,7 @@ public function __construct(array $config)
4039
$helper = plugin_load('helper', 'aichat');
4140
$this->useLanguageClusters = $helper->getConf('preferUIlanguage') >= AIChat::LANG_UI_LIMITED;
4241

43-
$this->similarityThreshold = $config['similarityThreshold']/100;
42+
$this->similarityThreshold = $config['similarityThreshold'] / 100;
4443
}
4544

4645
/** @inheritdoc */

action.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public function handleQuestion(Event $event, mixed $param)
5858
$sources = [];
5959
foreach ($result['sources'] as $source) {
6060
/** @var Chunk $source */
61-
if(isset($sources[$source->getPage()])) continue; // only show the first occurrence per page
61+
if (isset($sources[$source->getPage()])) continue; // only show the first occurrence per page
6262
$sources[$source->getPage()] = [
6363
'page' => $source->getPage(),
6464
'url' => wl($source->getPage()),
6565
'title' => p_get_first_heading($source->getPage()) ?: $source->getPage(),
66-
'score' => sprintf("%.2f%%", $source->getScore()*100),
66+
'score' => sprintf("%.2f%%", $source->getScore() * 100),
6767
];
6868
}
6969
$parseDown = new Parsedown();

cli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function main(Options $options)
8282
parent::main($options);
8383

8484
$model = $options->getOpt('model');
85-
if($model) {
85+
if ($model) {
8686
$this->helper->updateConfig(
8787
['chatmodel' => $model, 'rephasemodel' => $model]
8888
);

helper.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,10 @@ public function rephraseChatQuestion($question, $history)
259259
*/
260260
protected function prepareMessages(
261261
ChatInterface $model,
262-
string $promptedQuestion,
263-
array $history,
264-
int $historySize
265-
): array
266-
{
262+
string $promptedQuestion,
263+
array $history,
264+
int $historySize
265+
): array {
267266
// calculate the space for context
268267
$remainingContext = $model->getMaxInputTokenLength();
269268
$remainingContext -= $this->countTokens($promptedQuestion);

0 commit comments

Comments
 (0)